The <b>
tag in HTML is used to define bold text without implying any additional importance or relevance. While the <b>
tag visually styles text as bold, it is considered a presentational element. It’s use is often discouraged in favor of semantic elements like <strong>
for indicating stronger importance.
Syntax
<b> Text to be bold </b>
Example 1: Basic usage of <b>
Tag
<!DOCTYPE html> <html lang="en"> <head> <title>HTML b Tag</title> </head> <body> <p> This is a <b>bold</b> word in a sentence. </p> </body> </html>
Output: In this example, the <b>
tag is used to make the word “bold” visually bold within a sentence.
This is a bold word in a sentence.
Example 2: Nested <b>
Tags
<!DOCTYPE html> <html lang="en"> <head> <title>HTML b Tag</title> </head> <body> <p> <b>This is <b>important</b> information.</b> </p> </body> </html>
Output: Here, nested <b>
tags are used to emphasize a specific portion of text within a larger context.
This is important information.
Browsers Compatibility
Chrome | Edge | Firefox | Opera | Safari |
---|---|---|---|---|
2 | 12 | 1 | 15 | 1 |