From an article on accessibility, form, and content from w3.org
Initially, there were a pair of HTML elements whose purpose was to indicate
that some portion of the text required emphasis; and this pair of elements
allowed for two degrees of emphasis. The elements in question are the EM
and STRONG
elements. At a later stage, the elements for italic
and bold text were added; these are the I
and B
elements. Here is an example of all of them, again as straight markup,
<EM>This is emphasized text.</EM>
<STRONG>This is strongly emphasized text.</STRONG>
<I>This is italic text.</I>
<B>This is bold text.</B>
and as rendered text:
This is emphasized text.
This is strongly emphasized text.
This is italic text.
This is bold text.
Now, the I
element means, "render as italic text"; and the B
element, "render as bold". Obviously, these are both formatting commands. However, a glance at the EM
and STRONG
elements reveals that they are also rendered as italic and bold, respectively. What is the difference?
The difference is that if the markup is EM
or STRONG
,
then the text is declared as requiring emphasis, but only that. It
does not go further to declare how the text should be emphasized. On the other hand, while using I
or B
does emphasize the text, it does so in a purely visual way. "Italic" or "bold" are type setting directives for printed versions of the text. What if the markup were passed to a voice synthesizer to speak the text? How does one speak text that is bold? Using B
commits one to a specific way of rendering the text, specifically, a visual one; when, what is really desired is a declaration that this text is somehow different and to allow the expression of that difference to vary depending on the medium in which it is rendered. Indeed, even within a medium, there may be constraints, such as screen real estate, that alter how emphasized text can be drawn. Thus, the use of EM
and STRONG
elements is superior in the sense that they describe the content without committing it to a specific format.
No comments:
Post a Comment