Back to Library
Region:
Switch to ID
Advanced freeCodeCamp • lecture-understanding-nuanced-semantic-elements
When Should You Use the Strong Element Over the Bring Attention To Element?
Lesson Overview
The key distinction between the `<strong>` (strong importance) element and the `<b>` (bring attention to) element lies in **semantic meaning** versus **purely visual styling**.
The key distinction between the <strong> (strong importance) element and the <b> (bring attention to) element lies in semantic meaning versus purely visual styling.
Use the <strong> Element
Use <strong> when the content it wraps has strong importance, seriousness, or urgency.
- Semantic Meaning: It tells browsers, screen readers, and search engines that the enclosed text is genuinely more important than the surrounding content.
- Accessibility: Screen readers may alter the tone of voice when encountering
<strong>text to emphasize its importance to users who are visually impaired. - SEO: Search engines may place higher importance on keywords or phrases wrapped in
<strong>. - Examples: Warnings, alerts, critical instructions, or key points in a paragraph.
Use the <b> Element
Use <b> when you want to draw visual attention to text without implying that it has any special importance.
- Semantic Meaning: It has no semantic meaning. It is purely for stylistic purposes.
- Use Case: Use it for things that need to stand out visually but are not inherently “more important” than the rest of the text, such as a keyword in a paragraph, a product name, or a note that is just meant to be visually distinct.
- Note: If your only goal is to change the appearance of text (like making it bold), it is often considered best practice to use CSS (
font-weight: bold;) instead of adding HTML tags, unless the text has a specific role that justifies a semantic or presentational tag.
Summary Table
| Element | Purpose | Semantic? | Impact |
|---|---|---|---|
<strong> | Strong importance, urgency | Yes | Affects accessibility and SEO; usually renders bold. |
<b> | Bring attention to (stylistic) | No | Purely visual; does not convey importance. |
In short: If the content is “important,” use <strong>. If you just want it to “look different” or “stand out” without adding weight to its meaning, <b> is acceptable.