HTML <b> Tag
Example: This simple code example illustrates highlighting the text by making it as bold text in HTML.
The <b> tag in HTML is used to specify the bold text without any extra importance. The text is written within <b> tag display in bold size. You can do that by using font-weight: bold; property in CSS. It is a container tag that contains an opening tag, content & closing tag. There is a similar tag, <strong> tag that is the parsed tag and used to show the importance of the text & has a similar effect on content.
As per the HTML5 specification, the <b> tag should be used as a last option to resort when no other tag is more appropriate. The HTML5 specification states that for headings, it should be depicted by the <h1> to <h6> tags, for emphasized text, it must be depicted by the <em> tag & similar wise, the important text by the <strong> tag, & for marked/highlighted text, it should be denoted with the <mark> tag.
<b> Contents... </b>
Accepted Attributes: This is a Global attribute, and can be used on any HTML element.
Example 1: In this example, we have used the <b> tag & <p> tag to illustrates the difference in the text appearance & their sizes.
Example 2: In this example, we have used the CSS font-weight property whose value is set to bold to make the text bold.
- Google Chrome
- Edge 12 and above
- Internet Explorer
- Microsoft Edge
- Firefox 1 and above