HTML <b> tag
The <b> tag defines the bold texts.The texts within the <b> tag and </b> will be displayed boldly. It is used to draw attention to the texts.
Type: Inline Element
Syntax of <b> tag
<b> Bold Texts </b>
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <b> | Yes | Yes | Yes | Yes | Yes |
There are two HTML tags that can make bold text. - <b> and <strong>.
The texts or characters within all these elements will be rendered in the same style (bold text) but their purposes and when to use are different.
| Tag | Purpose | Valid in HTML5 |
|---|---|---|
| <strong> | makes bold and important text with semantic meaning. | ✔ |
| <b> | makes bold text only for style and attraction. | ✔ |
Full code example
<!DOCTYPE html> <html> <head> </head> <body> <p>These are normal texts.</p> <p><b>These are bold texts.</b></p> </body> </html>
Output on the browser
These are normal texts.
These are bold texts.
More reference
Note that <b> tag should not be used frequently. It should be used only when no other appropriate tag is available. For writing headings, use <h1> to <h6> which are bold by default. To write strong text, use the <strong> tag, and to write emphasized text, use the <em> tag.
You can also use the CSS "font-weight" property to make bold text.
<!DOCTYPE html> <html> <head> <style> p { font-weight: bold; } </style> </head> <body> <p>This is bold text.</p> </body> </html>
