Semantically speaking, is there an appropriate place in today's websites (late 2008+) where using the bold <b>
and italic <i>
tags are more useful than the more widely used <strong>
and <em>
tags?
views:
796answers:
16Never. They are removed in XHTML 2.0 as they are presentational tags. CSS should be used to bold/italicise content.
edit: If you're looking for a purely presentational tag, that's what the SPAN
tag with a class and a little CSS is for.
When writing websites for mobile devices. They don't always support the 'latest and greatest' standards, are depreciated but not deleted from all modern browsers, and simply take up less space and bandwidth (though in theory the streams are compressed by either the websites or the wireless browser, it can't be counted on).
The <b> and <i> tags don't have semantic meaning, whereas <strong> and <em> do. If a reader read the block of text aloud it would react to the <strong> and <em> tags, whereas the <i> and <b> tags would be ignored, and treated and purely visual elements. I tend to regard <i> and <b> as deprecated.
Whenever you want to do things incorrectly ... just kidding.
The real answer is never, these tags have been deprecated by the W3C
Neither <b> nor <i> are semantic tags, so purists would say they should not be used. Where I've seen their use justified are in things like putting online content in print where text was bolded or italicized as a matter of convention, but not as a manner of strengthening or emphasizing content.
The easy example is if you're putting online a magazine article that references a book by its title: you may want to put the book title in italics, but the italics are not for emphasis, so the <em> tag would be inappropriate. You could use <i> here, but the semantic thing to do would be to use something like <span class="booktitle"> and then use CSS to make booktitles italics. You are referencing a title, not putting emphasis, and you wouldn't want a screen reader to put verbal emphasis on the title.
My personal opinion is to not use either <b> or <i> today, but using <strong> or <em> as their substitutes when you aren't really looking to do anything besides bold or italicize the text is equally incorrect.
While in general I would stay away from non-semantic tags like b
and i
, strong
and em
are not direct replacements for b
and i
.
I would use b
or i
when it's only presentation you're going for, and what you're marking up has no semantic meaning. For example, a logo like stackoverflow could be marked up with stack<b>overflow</b>
. The "overflow" portion has no semantic meaning over "stack", yet stack<span class="overflow-logo">overflow</span>
doesn't offer anything either.
Hope this helps.
Not sure how to comment (edit: need moar karma!), but this is in reply to Erik's comment.
Please read the HTML5 working draft. It gives a good explanation on when to use b
.
The
b
element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.
"overflow" does not have emphasis over "stack" in the logo, therefore wrapping "overflow" with em
is semantically incorrect.
I think when you're trying to make your markup meaningful, these are rarely useful.
There are, however, new tags that produce some of the same results, but which provide even more semantic value. I like to use the <cite> tag when I'm referring to the name of a book, for example, as it still gets italicised, but the HTML now carries meaning about why.
There are a variety of other semantic tags that can also affect formatting listed here:
I've been using <b> for years to indicate key words on my web site. I wrote a small utility that crawls the site looking for <b> tags and adds them to an index. I use <strong> when I want to bold a word without adding it to the index. I have used this convention for years -- too late to quit now.
According to the HTML 5 spec, <b>
and <i>
should be used when appropriate.
[A] span of text in an alternate voice or mood, or otherwise offset from the normal prose, such as a taxonomic designation, a technical term, an idiomatic phrase from another language, a thought, a ship name, or some other prose whose typical typographic presentation is italicized.
[A] span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is boldened.
Generally speaking, "when appropriate" is deemed to be as a last resort, when all other semantic options have been exhausted. "Presentational" though they may be, it would certainly be a disservice to their semantic cousins <em>
and <strong>
to consider them always italic or bolded, respectively.
On http://www.webmasterworld.com/forum21/7095-1-15.htm there's a good comment:
"If page readers really read every
<strong>
tag in a strong voice, or really emphasize every<em>
section on a page, then the poor user gets a page shouting at her or him on a regular basis.I think this issue is really a no-brainer. If I am setting a bold or italic font for purposes of typography only, then I use
<b>
and<i>
. If there's a word or phrase that I want to emphasize as I would in speaking, then - and only then - do I use<strong>
or<em>
."
It could be argued that there is still a use for the <i>
tag: when expressing the scientific name (aka the Latin name) of a species. The scientific name of a species is, by convention, usually presented in italics. Example. It is semantically incorrect to use <em>
in this situation because one is not trying to emphasise the name but rather merely distinguish it visually. It may be more appropriate to use something like <span class="sci-name">
, but when one considers that most scientific names are composed of words of the italic languages, mainly Latin, the <i>
tag becomes a rather sematically rich and convenient solution.
There are technical rules, but here are my two rules of thumb:
1) If you are writing something where, if spoken, you would emphasize a word, < strong > and < em > are appropriate. (E.g., "You have got to be sh*tting me, Pyle!")
2) If you are emphasizing a word for a technical reason, but would not emphasize the word in spoken conversation, < b > and < i > are appropriate. (E.g., "He boarded the RMS Titanic and sailed away, never to be seen again.")
Don't leave out other tags like < cite >, though!
Officially, <i /> and <b /> are "presentational" and shouldn't be used. While many developers think that <em /> and <strong /> are presentational, they are not. They are generally italicized and bolded resopectively, but the CSS can (and should, when appropriate) change how the emphasis and strongness could be displayed.
Similar things could be done with css on a <span /> tag, and many consider that the preferred method, but it isn't substantiatable with the specification.