HTML provides semantic inline tags so meaning survives without CSS. Prefer them over naked span wrappers whenever the semantics fit.
Stress and importance
<strong>: strong importance, warnings, critical keywords—not arbitrary bold.<em>: emphasis that changes spoken stress or interpretation.<b>/<i>: stylistic offsets without implied semantics—use rarely.
Scientific and editorial marks
<sub>/<sup>for subscripts and superscripts.<mark>for relevance highlighting (search hits).<small>for disclaimers and fine print—not merely tiny text.
Edits over time
<del>+<ins>pair legal revisions when timestamps matter.<s>marks content no longer accurate without claiming replacement text.
Decision checklist
- If stripping CSS changes how you’d read meaning aloud, pick a semantic tag.
- If only visuals differ (brand font weight), use CSS.
- Combine semantics + CSS:
<strong class="badge">is valid when emphasis and styling align.
What slips through PR review
b/icreep: quick bold/italic hacks without checking whether emphasis/importance semantics apply—screen readers behave differently.- Fake lists: using line breaks plus bullet characters instead of
ul/li—pagination, copy/paste, and assistive tech lose list semantics. - Language mixing: phrases in another tongue should carry
langso pronunciation stays correct.
Example — semantic inline tags
<p>
<strong>Warning:</strong> backup runs at midnight.
The keyword is <em>incremental</em>, not full.
Formula: <var>n</var> <sup>2</sup> + <mark>highlighted term</mark>.
</p>
Rendered output
Warning: backup runs at midnight. The keyword is incremental, not full. Formula: n 2 + highlighted term.
Important interview questions and answers
- Q: When should you use `strong` vs `b`?
A: Use `strong` for semantic importance; use `b` only for stylistic offset without importance semantics. - Q: Why is `target="_blank"` usually paired with `rel="noopener"`?
A: It blocks the opened page from controlling the opener via `window.opener`, improving security. - Q: Why avoid fake buttons built with ``?
A: Anchors are for navigation; actions should use `
Tip: Prefer semantic elements (strong, em) over presentational tags.