When to use <strong> and when to use <b>? [duplicate]
Possible Duplicate:
Is it ok to use <strong> in place of <b> blindly ?
When to use <strong>
and when to use <b>
or other ways to give look of bold? strong
has semantic value ( and useful for screen reader while b
is presentation (and even valid in HTML 5).
my question is not what is the difference between strong
and b
.
The question is when to use semantic tag and when to use just to make text bold
Should I always use <strong>
if client's content files (MS word files) has some words bold in content paragraphs?
alt text http://shup.com/Shup/365676/11051764618-My-Desktop.png
How can we know when client want to give emphasis to text and when he just want to make text bold for presentation/aesthetic purpose?
If it's client job to tell us, then how to explain this scenario to client to give us clear info on "when he just want to make text bold for presentation/aesthetic p开发者_如何学Gourpose" ?
I've always followed a simple rule of thumb:
<strong>
means "strong emphasis", and implies no particular visual style. It has semantic meaning, but could look like anything.<b>
is used to apply a bold visual effect to text, but is a presentational tag like<font>
and so should be avoided (where possible) in favour of CSS.
How can we know when client want to give emphasis to text and when he just want to make text bold for presentation/aesthetic purpose?
Read the client's text with understanding.
- use
<strong>
when the context says that the bold text is more important than the other (and it is inline) - use
<b>
if it just should be bold (even in database, feed reader or without stylesheets). In this case boldness may be used to catch the readers eye.
When in doubt, ask the client what did he meant.
To save you and yourself a hassle, ask the client to use formatting styles in his editor. This is very useful feature, pity that there few people who do know what for this feature is.
Edit:
This is strong and this is bold. Any difference?
All the problems begin here. If the strong
were by default colored RED (no red markup on SO), and normal weight, there would be no questions like this.
There's no "right" answer to this (which is probably why semantic markup isn't in a good state).
Depending on the way your client works I'd say your proposal to replace emboldened content in paragraphs with <strong>
, and everything else with relevant heading styles, is reasonable. It may be a good idea to sample the documents to establish what practice has been used.
First ask the client "why have you highlighted these words?" and use that to inform your decision. If you can't get a clear answer, I'd use <B> since it's better to not imply that there are semantics to the highlighted words when in fact there are none. Use of <B> can be used as a clear indication that you have unsatifactory presentational markup, and therefore helpful to future maintainers that it can be freely corrected in the light of new information about the reason for the highlighting.
If you're doing a conversion of a word document to HTML, then I think <b>
is a better choice, because you're conveying the fact that the text was bold in the word document. Word uses styles to apply semantic meaning, so if it's marked with the "Strong" style, then you use the <strong>
tag in the HTML.
Using CSS to define a style other than default bold for a <strong>
tag is understandable.
Using CSS the same way on a <b>
tag would be more questionable.
精彩评论