HTML Text Formatting: Semantics First, Styling Second

A few years ago I reviewed a checkout page that looked fine in Chrome, but a screen reader user reported something unsettling: the “IMPORTANT” shipping note was read with the same priority as the rest of the paragraph. The developer had used everywhere because it “makes things bold.” Visually, the message popped. Semantically, it was just… ordinary text wearing a louder font.

That’s the core tension in HTML text formatting: you’re not just painting pixels; you’re encoding meaning. When you choose the right tag, you help browsers, assistive tech, translation tools, indexing systems, and even internal search treat your content the way you intended. When you choose the wrong one, your UI may still look correct, but your document becomes harder to understand and harder to maintain.

If you build anything that people read—docs, product pages, dashboards, emails rendered in the browser—these tags matter. I’ll walk through the formatting elements you’ll actually use, how I decide between semantic vs purely visual formatting, what to avoid, and a couple runnable examples you can paste into a file and open locally.

Text formatting is semantics first, styling second

HTML gives you two broad “families” of text formatting:

  • Semantic (logical) formatting: tags that describe meaning (importance, stress emphasis, edits). The browser typically applies a default style, but that style is not the point.
  • Presentational (physical) formatting: tags that primarily affect appearance (bold, italic) without promising meaning.

I like a simple rule: if you’d still want the meaning to survive after all CSS is removed, pick a semantic tag.

Here’s a quick map of the common formatting tags and what they communicate:

Tag

What it means

Typical default style

I reach for it when…

strong importance/urgency

bold

the content is important even if not bold

stress emphasis (spoken emphasis)

italic

changing emphasis changes meaning

stylistic offset (no added importance)

bold

keywords, labels, product names in a sentence

stylistic offset (no stress emphasis)

italic

foreign words, thoughts, taxonomy terms

highlight as relevant

yellow-ish highlight

search hits, “recent change” highlight

side notes / fine print

smaller text

disclaimers, legal qualifiers, metadata

inserted content

underline

change tracking, “new policy text”

removed content

strikethrough

change tracking, deprecated info

subscript

lowered baseline

chemical formulas, indices

superscript

raised baseline

exponents, footnote markersA key point: default rendering is not a contract. is commonly bold, but you can style it however you want and it still signals importance. Same with and italics.

A modern workflow note (2026)

Today’s editors and CI pipelines can flag semantic mistakes automatically. I often run an HTML linter plus an accessibility checker as part of pre-commit (or in CI), and I’ll ask an AI code assistant to review diffs specifically for semantic correctness. The goal isn’t to “make the text bold.” The goal is to make the document accurate.

Emphasis and importance: how I choose vs

and are the two tags I consider “default” for meaning-driven formatting.

: importance, urgency, seriousness

I use when the text should be treated as important regardless of how it looks.

Examples where is usually correct:

  • Safety warnings: “Do not mix with bleach.”
  • Irreversible actions: “Deleting this key cannot be undone.”
  • Required constraints: “You must verify your email to continue.”

Runnable example:






strong vs b

body { font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; padding: 24px; }

.note { border-left: 4px solid #c0392b; padding: 12px 16px; background: #fff6f6; }

/ Intentionally NOT styling strong as bold, to prove the meaning still exists /

strong { font-weight: 600; color: #8e1b10; }

Important: Regenerating this API key invalidates the old key immediately.

Here’s a stylistic label using b in a sentence: SKU is the internal inventory identifier.

Notice what I did: I styled for emphasis, but I could have styled it neutrally and the markup would still be correct.

: stress emphasis (like spoken emphasis)

means the writer is stressing a word or phrase. If you read the sentence aloud, it’s the part you’d emphasize.

This matters because emphasis can change meaning:

  • “I didn’t say you shipped it.”
  • “I didn’t say you shipped it.”
  • “I didn’t say you shipped it.”

Same words, different implication.

Runnable example with nested emphasis:






em emphasis

body { font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; padding: 24px; }

em { font-style: italic; }

/ Nested emphasis is allowed; browsers typically increase the emphasis level /

em em { font-style: normal; text-decoration: underline; }

You can cancel the subscription at any time, but you must do it from the billing page.

If you keep the service running, you agree to the updated terms today.

I’m not telling you to nest often. I’m showing that HTML has a concept of “levels” of emphasis and that you should treat emphasis as meaning, not italics.

My decision shortcut

When I’m deciding between tags, I ask myself:

  • “Is this word stressed in the sentence?” →
  • “Is this message more important than surrounding content?” →
  • “Do I only want a typographic offset?” → maybe or , or a class on a

Presentational tags: when I still use and (and when I don’t)

People sometimes treat and as “legacy.” I don’t. I treat them as specific tools with a narrow job: stylistic offset without semantic emphasis.

: stylistic offset, not importance

I use for:

  • Inline labels in prose: “Set ENV to production.”
  • Keywords in an explanation: “A nonce is used once.”
  • Summary lists where bold is purely visual and does not change meaning.

I do not use for warnings, errors, or required actions. That’s territory.

: alternate voice or mood

I use for:

  • Foreign words or phrases: “The term raison d’être…”
  • Thoughts or internal monologue (in narrative content)
  • Taxonomy or scientific names (common pattern)

I do not use when the purpose is actual stress emphasis. That’s .

Traditional vs modern pattern (what I recommend)

Here’s how I draw the line in real projects:

Goal

Traditional approach

Modern approach I recommend —

— Make important text stand out

Warning:

Warning: + CSS if needed Emphasize a word in a sentence

must

must Style a keyword in prose

token

token or token Style a UI label

Save

semantic element (
Scroll to Top