Suggest an editImprove this articleRefine the answer for “Difference between strong and b tags in HTML”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`<strong>` vs `<b>`** - both render bold text, but `<strong>` also marks content as important for screen readers and search engines. ```html <b>Product name</b> <!-- bold only, no semantic weight --> <strong>Warning!</strong> <!-- bold + flagged as important in accessibility tree --> ``` **Key:** use `<strong>` when the text carries meaning, CSS `font-weight: bold` when it is styling only.Shown above the full answer for quick recall.Answer (EN)Image**`<strong>` and `<b>`** both make text bold by default, but only `<strong>` tells the browser, and everything listening to it, that the text actually matters. ## Theory ### TL;DR - `<b>` = marker highlight on paper: changes how it looks, says nothing about why - `<strong>` = starred email: changes how it looks AND flags it as important - Screen readers stress `<strong>` content; they read `<b>` flat, like any other text - Both get `font-weight: bold` from user agent stylesheets, so visually they look identical - Decision rule: meaningful emphasis → `<strong>`. Pure style → CSS `font-weight: bold` ### Quick example ```html <p>Regular text, then <b>bold but no meaning</b>.</p> <!-- Screen reader: reads "bold but no meaning" flat, no stress --> <p>Regular text, then <strong>important bold</strong>.</p> <!-- Screen reader: stresses "important bold" with raised pitch --> ``` Open this in a browser with NVDA or VoiceOver and you hear the difference instantly. Visually? Identical. ### Key difference `<b>` is a presentational tag. It puts bold in the render tree and stops there. `<strong>` goes further: browsers map it to an importance role in the accessibility tree, which AT APIs like MSAA and IAccessible2 pick up. That is why screen readers announce `<strong>` content with stress or a prefix like "important", while `<b>` gets nothing extra. ### When to use - Product name or UI label where bold is a pure design choice → CSS `font-weight: bold`, or `<b>` as a last resort - Warning, deadline, or error message the reader must not miss → `<strong>` - Legacy code that needs bold for appearance only → add a CSS class, avoid both tags - Accessibility or SEO is a priority → always `<strong>`, never `<b>` ### Comparison table | Aspect | `<b>` | `<strong>` | |---|---|---| | Default style | Bold | Bold | | Semantics | None (presentational) | Importance | | Screen readers | Reads flat | Announces with stress | | SEO impact | Neutral | Signals keyword relevance | | Accessibility tree | Not mapped | Mapped to importance role | | When to use | Rare; visual-only labels | Warnings, key facts, articles | ### How the browser handles this Both tags get `font-weight: bold` from the browser's built-in stylesheet, which is why they look the same without custom CSS. The split happens in the accessibility tree: `<strong>` gets an importance role that assistive technologies read from the OS-level accessibility API; `<b>` stays in the render tree only. One CSS rule (`strong { font-weight: normal; }`) strips the visual bold from `<strong>` but leaves the semantic role intact. Screen readers still stress it. ### Common mistakes **Using `<b>` for warnings or critical text:** ```html <!-- Wrong: screen reader reads this flat --> <p>Warning: <b>High voltage area</b>. Do not enter.</p> <!-- Right: screen reader stresses the warning --> <p>Warning: <strong>High voltage area</strong>. Do not enter.</p> ``` **Assuming `<strong>` always means bold styling:** ```css /* This strips visual bold but NOT the semantics */ strong { font-weight: normal; } ``` If a custom theme resets `<strong>` visually, AT still flags it as important. Tie style to a CSS class, not to the tag itself. **Nesting `<b>` inside `<strong>` carelessly:** ```html <strong>Critical: <b>check this</b> before deploy.</strong> ``` The outer `<strong>` applies its importance role to all content inside, including the `<b>` part. The `<b>` only adds a visual hook. This is valid HTML, but flattening it to one `<strong>` with CSS control is cleaner and clearer in intent. ### Real-world usage - MDN Web Docs uses `<strong>` for warnings and deprecated API notices throughout its guides - React docs wrap required prop names in `<strong>` to signal importance, not just styling - WordPress Gutenberg defaults to `<strong>` when you press the bold button in the editor toolbar - Bootstrap documentation recommends `<strong>` over `<b>` in its typography section ### Follow-up questions **Q:** Can CSS make `<strong>` and `<b>` completely identical? **A:** Visually, yes. But semantically, no. The accessibility tree still marks `<strong>` as important and screen readers still react to it, regardless of how it looks on screen. **Q:** Does Google treat `<strong>` differently from `<b>` for SEO? **A:** Google has confirmed that `<strong>` carries weight as a keyword relevance signal. `<b>` is treated as neutral styling. The difference matters for content with keywords you want to rank for. **Q:** Is `<b>` still valid in HTML5? **A:** Yes. HTML5 keeps `<b>` and redefines it as a tag for text that is "stylistically different" without conveying importance. It is valid, but WCAG 4.1.2 pushes toward semantic alternatives wherever meaning is involved. **Q:** How does `<strong>` behave inside an `aria-hidden` container? **A:** The semantic role gets suppressed and assistive technology skips the content entirely. If you place `<strong>` inside a container with `aria-hidden="true"`, screen readers will not announce it regardless of the tag. ## Examples ### Basic: visual vs semantic bold ```html <!DOCTYPE html> <html lang="en"> <body> <p>Save your work often. <b>Autosave</b> is disabled by default.</p> <!-- "Autosave" looks bold, screen reader reads it flat --> <p>Save your work often. <strong>Autosave is disabled</strong> by default.</p> <!-- Screen reader stresses "Autosave is disabled" --> </body> </html> ``` `<b>` here just makes the word stand out visually. `<strong>` tells the user, and every tool reading the page, that this is something to pay attention to. ### Intermediate: React component with semantic emphasis ```jsx // OrderSummary.jsx function OrderSummary({ productName, deadline }) { return ( <article> <h2>Order Summary</h2> <p> You selected <b>{productName}</b>. {/* Visual label only - no semantic weight needed */} </p> <p> Complete payment by <strong>{deadline}</strong> to avoid cancellation. {/* Deadline is important - screen reader stresses it */} </p> </article> ); } ``` `<b>` on the product name is a design choice. `<strong>` on the deadline is a signal: if a user navigates by screen reader, they should not miss that date.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.