Jump to content

Is <b> Deprecated?


blogsmith
 Share

Recommended Posts

Yes, it is. Use <strong> if you want to convey semantic "strong"-ness, or CSS otherwise. You can always search for the tag in a relevant strict DTD such as the HTML 4.01 one.Whoops, I missed a bit: http://www.w3.org/TR/REC-html40/present/graphics.html#edef-B.

Link to comment
Share on other sites

No, <b> is not deprecated. It's still useful because not all bold text needs strong emphasis. Sometimes the text may need to be bold for other reasons and there's not proper semantic tag for it.

Link to comment
Share on other sites

From the HTML5 Draft:

The b element should be used as a last resort when no other element is more appropriate. In particular, headings should use the h1 to h6 elements, stress emphasis should use the em element, importance should be denoted with the strong element . . .
So we're in a gray area. If you are using bold in a semantic way (ie, it adds to the meaning in someway) you may use <b>. Keep in mind that it will probably have no effect for non-visual browsers, such as those designed for people with disabilities. <strong> does work correctly for all kinds of browsers. But the result may vary. The HTML specifications do not indicate how a browser should implement the strong tag. For that matter, they also say this about the b tag:
it is not the case that content in b elements will necessarily be boldened.
If you want bold ONLY for style reasons, use a span. It would be very easy to create a class called "bold", where the only style definition is font-weight:bold. That would look like this:
Hello I want to emphasize <span class="bold">this</span> word.

If it's an unusual thing, the following technique would not be terrible:

Hello I want to emphasize <span style="font-weight:bold">this</span> word.

Either way, the visual result is guaranteed.OTOH, if you want to make a whole div or paragraph bold, then adding the font-weight definition to a more complete CSS element or class description would be more appropriate.

Edited by Deirdre's Dad
Link to comment
Share on other sites

I put a <b> tag in some markup when I was testing something recently. I noticed it didn't produce a validation error (I have a Firefox addon which validates the current page locally).I tend to just use <strong> anyway. I do agree with Deirdre's Dad's comments, though.

Link to comment
Share on other sites

I put a <b> tag in some markup when I was testing something recently. I noticed it didn't produce a validation error (I have a Firefox addon which validates the current page locally).I tend to just use <strong> anyway. I do agree with Deirdre's Dad's comments, though.
depends on the DTD you were using though. Transitional vs. Strict would have differences in what throws errors or not.
Link to comment
Share on other sites

Ah I see. I was using HTML 4.01 Transitional. I needed, okay, wanted :), the target="_blank" attribute for some of the links. I know I could have used window.open but there were no other scripts on the page, and it was just a single page, as opposed to a huge project, so I decided just to alter the doctype.

Link to comment
Share on other sites

As Ingolme wrote, it is not deprecated, not now and not in the HTML5 Draft. So of course a validator won't object. But if you care about what you're doing, you'll think twice about using it.I think a huge reason it remains part of the spec is that there is a HUGE body of text out there with embedded <b> tags in it. Changing a lot of documents to Strict HTML would be an easy process except for presentational tags like that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...