HTML/Elements/b

From Web Education Community Group
< HTML‎ | Elements
Revision as of 17:17, 22 November 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<b>

The <b> element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance.

Point

  • Some examples of cases:
    • key words in a document abstract
    • product names in a review
    • ... other spans of text whose typical typographic presentation is boldened.
  • 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, and text marked or highlighted should use the mark element. [Example of bad usage]
  • Authors can use the class attribute on the b element to identify why the element is being used, so that if the style of a particular use is to be changed at a later date, the author doesn't have to go through annotating each use. For more information see W3C Internationalization articles [Using <b> and <i> elements]


HTML Attributes

See global attributes.


Examples

Example A

[try it]

<p>The <b class="keyword">frobonitor</b> and <b class="keyword">barbinator</b> components are fried.</p>

B01.png

Example of bad usage

The b element also isn't intended to convey importance; for that purpose, the strong element is more appropriate.

<!-- do not copy this example, it is an example of bad usage! -->
<p><b>Warning.</b> This dungeon is dangerous.</p>

Good usage:

<p><strong>Warning.</strong> This dungeon is dangerous.</p>


HTML Reference

The HTML5 specification defines the <b> element in 4.6.17 The b element.