HTML <b> Tag β Bold Text (Visual Only)
π Introduction
The <b> tag is used to make text bold in HTML.
Unlike <strong>, the <b> tag does not add meaning to the text. It is only used for visual styling.
π§± Syntax
<b>Bold text here</b>
π‘ Example
<!DOCTYPE html>
<html>
<head>
<title>B Tag Example</title>
</head>
<body>
<p>This is normal text.</p>
<p>This is <b>bold text</b> using the b tag.</p>
</body>
</html>
π₯οΈ Output Explanation
- Normal text appears regular
- Text inside
<b>appears bold - But it has no semantic meaning
π― When to Use <b>
Use <b> for:
- Keywords in a sentence
- Product names
- Visual highlighting without importance
Example:
<p>Buy our <b>Premium Plan</b> today.</p>
βοΈ <b> vs <strong>
| Tag | Meaning | Use |
|---|---|---|
<b> |
Bold (visual only) | Styling |
<strong> |
Important text | Meaning + accessibility |
Example:
<p>This is <b>just bold</b>.</p>
<p>This is <strong>important</strong>.</p>
β Use <strong> for meaning
β Use <b> only when you donβt need importance
β οΈ Important Note
Modern web development recommends:
π Prefer <strong> over <b> when meaning matters
π Use <b> only for visual styling cases
π« Common Mistakes
- Using
<b>for important warnings β - Replacing headings with
<b>β - Overusing bold text everywhere β
π¨ Styling <b>
You can still style it with CSS:
<b style="color:red;">Special offer</b>
π§ͺ Mini Exercise
Create a page with:
- A product description
- Use
<b>to highlight:- Product name
- Price
- Feature keywords