Forum Moderators: open
I'm just brushing up on my web skills by doing a few courses, and one of the trainers I was listening to said that the bold tag had been deprecated in favour of the strong tag. Likewise, the <i> tag had been deprecated in favour of <em>.
However, I have also heard SEO gurus recommend using the bold tag to emphasise certain keywords.
Who's right? If you use the <strong> tag, will you get the same SEO benefits?
I can't see everyone swapping <b> for <strong> any day soon, as it's so much easier to type just <b>. And in HTML 4, it makes absolutely no difference to the display.
But someone who teaches you that <b> should be replaced with <strong> and <i> with <em> hasn't got the slightest idea of the meaning of these elements. Both <strong> and <em> are semantical elements (just as <code>, <abbr> and others) and most browsers have chosen to display them in bold and italic, but this is just a choice. The true meaning of these element is to emphasize the enclosed text, but the standard doesn't tell how to render the enclosed contents. From the HTML 4.01 specs:
The presentation of phrase elements depends on the user agent. Generally, visual user agents present EM text in italics and STRONG text in bold font.
Browsers will recognize the <b>, <i> and <font> elements for many years to come so existing sites shouldn't worry. But for new pages it is good to decide of alternate rendering is necessary because of semantic reasons (use <strong> and <em> ) or graphical reasons. In the latter case I would use CSS.
cheers,
gary
What if you have a logo where the first letter is bold, or italic, but you don't want it to be seen as emphasised?
That's why you use CSS. You certainly don't want to break it up by adding multiple tags. Screen readers are likely to treat them as separate words.
<h1>Company</h1>
h1::first-letter {
font-weight: bold;
}
Perhaps we should be using <span class="bold"> instead of <b> or <strong>?
<span class="bold"> is completely meaningless in terms of semantics, has no fallback styling for non-CSS user agents, and is much more verbose than simply using <b>. <span class="bold"> is just as presentational as <b> too - it serves no other purpose than for style. I often use
<b> or <i> as generic inline containers rather than using a <span> - they can be styled in the same way as any other element. <b> and <i> have been removed completely in XHTML 2.0
As the final specification hasn't been published, it is impossible to tell whether they will be in XHTML 2.0 or not - but as XHTML 2.0 will not be backwards-compatible anyway, there is really no comparison between current markup practices and potential future standards.
Likewise, a foreign word or phrase should be italicized. (...) It might be argued that the phrase should have been wrapped in a span element with the lang="fr" attribute
It is usually best to do something like this:
<p>A [b]<i lang="fr">[/b][i]soi-disant[/i][b]</i>[/b] expert.</p> Again, no need to use a span.
<span class="bold"> is just as presentational as <b> too - it serves no other purpose than for style
With <b> the browser will make the text bold. But we are told to remove presentation from our markup and just leave semantics. What if I want to emphasize the text but not make it bold, as it doesn't fit the layout? I have to restyle the bold tag in CSS. At least <span> has no presentational meaning, so could be styled anyway you like, eg: bold, italic, underlined.
<p>A <i lang="fr">soi-disant</i> expert.</p>Again, no need to use a span.
I'm pretty sure this is the wrong way to do it. Again, you're forcing the markup to indicate foreign words as italic. I've always seen spans used for showing language, as they do not force a style on the user.
cheers,
gary