Summary
The HTML <b>
Element represents a span of text stylistically different from normal text, without conveying any special importance or relevance. It is typically used for keywords in a summary, product names in a review, or other spans of text whose typical presentation would be boldfaced. Another example of its use is to mark the lead sentence of each paragraph of an article.
Usage notes:
- Do not confuse the
<b>
element with the {{HTMLElement("strong")}}, {{HTMLElement("em")}}, or {{HTMLElement("mark")}} elements. The {{HTMLElement("strong")}} element represents text of certain importance, {{HTMLElement("em")}} puts some emphasis on the text and the {{HTMLElement("mark")}} element represents text of certain relevance. The<b>
element doesn't convey such special semantic information; use it only when no others fit. - Similarly, do not mark titles and headings using the
<b>
element. For this purpose, use the {{HTMLElement("h1")}} to {{HTMLElement("h6")}} tags. Further, stylesheets can change the default style of these elements, with the result that they are not necessarily displayed in bold. - It is a good practice to use the class attribute on the
<b>
in order to convey additional semantic information (for example<b class="lead">
for the first sentence in a paragraph). This eases the development of several stylings of a web document, without the need to change its HTML code. - Historically, the
<b>
element was meant to make text boldface. Styling information has been deprecated since HTML4, so the meaning of the<b>
element has been changed. - If there is no semantic purpose on using the <b> element, using css property font-weight with bold value would be a better choice for making text bold.
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | {{no_tag_omission}} |
Permitted parent elements | Any element that accepts phrasing content. |
DOM interface | {{domxref("HTMLElement")}} Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element. |
Attributes
This element only includes the global attributes.
Example
<p> This article describes several <b>text-level</b> elements. It explains their usage in an <b>HTML</b> document. </p> Keywords are displayed with the default style of the <b> element, likely in bold.
Result
This article describes several text-level elements. It explains their usage in an HTML document.
Keywords are displayed with the default style of the <b> element, likely in bold.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-b-element', '<b>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-b-element', '<b>')}} | {{Spec2('HTML5 W3C')}} | |
{{SpecName('HTML4.01', 'present/graphics.html#h-15.2.1', '<b>')}} | {{Spec2('HTML4.01')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
See also
- Others elements conveying text-level semantics: {{HTMLElement("a")}}, {{HTMLElement("em")}}, {{HTMLElement("strong")}}, {{HTMLElement("small")}}, {{HTMLElement("cite")}}, {{HTMLElement("q")}}, {{HTMLElement("dfn")}}, {{HTMLElement("abbr")}}, {{HTMLElement("time")}}, {{HTMLElement("code")}}, {{HTMLElement("var")}}, {{HTMLElement("samp")}}, {{HTMLElement("kbd")}}, {{HTMLElement("sub")}}, {{HTMLElement("sup")}}, {{HTMLElement("i")}}, {{HTMLElement("mark")}}, {{HTMLElement("ruby")}}, {{HTMLElement("rp")}}, {{HTMLElement("rt")}}, {{HTMLElement("bdo")}}, {{HTMLElement("span")}}, {{HTMLElement("br")}}, {{HTMLElement("wbr")}}.
- Using <b> and <i> elements (W3C)
{{HTMLRef}}