The <b> tag is used to highlight text by making it bold (it's called b for bold 🇺🇸).
Unlike other tags such as <strong>, the <b> tag does not add any particular meaning to the content; it is purely stylistic.
It is suitable for cases where you simply want to visually differentiate a portion of text without indicating that it is particularly important. 😉
Â
Structure and syntax of the <b> tag
Basic structure and syntax
The <b> tag is a container tag (it works in pairs) that surrounds the text you want to make bold. It has:
- an opening tag
<b>; - and a closing tag
</b>.
Â
Usage examples
For example, this text will be entirely in bold:
<b>This text is bold.</b>But it is also possible to adjust the tags so that they only make certain parts of a paragraph bold:
<p>This <b>text</b> is partially <b>bold</b>!</p>Give it a try yourself! 😋
Â
Attributes
The <b> tag has no specific attributes. However, like all HTML tags, it can accept classic attributes (for example, the class, id, and style attributes).
Â
Browser compatibility
The <b> instruction is compatible with all browsers.
| Element | Google Chrome | Safari | Mozilla Firefox | Edge |
| <b> | Yes | Yes | Yes | Yes |