Text-level semantics: strong, em, code, mark and more

The inline elements that give words meaning, and how to pick the right one.

  • Beginner
  • 5 min read
  • Updated 17 Oct 2026

What you will learn

  • Choose elements by meaning, not appearance
  • Mark up code, dates and abbreviations
  • Tell strong, em, b and i apart

Before you start

Inside paragraphs and headings, a set of inline elements marks what individual words and phrases mean: importance, emphasis, code, dates, abbreviations and more. This lesson is a reference you can come back to whenever you are unsure which one fits.

Importance and emphasis: strong and em

strong marks content of strong importance, seriousness or urgency. em marks stress emphasis, the kind that changes the meaning of a sentence when you say it aloud.

HTML
<p><strong>Warning:</strong> the oven is hot.</p>
<p>I did <em>not</em> say the bread was stale.</p>
<p>I did not say the <em>bread</em> was stale.</p>

The two em examples mean different things: the first denies saying it at all, the second suggests something else was stale.

Browsers show strong in bold and em in italics by default, but you choose them for meaning. Most screen readers do not change their voice for these elements by default, so do not rely on them alone for critical information. Write the warning in words too, as in the first example.

Bold and italic without extra importance: b and i

b and i are not deprecated. They have their own meanings in the Living Standard:

  • b draws attention to text without adding importance: keywords in a summary, product names in a review.
  • i marks text in an alternative voice or mood: technical terms, ship names, thoughts, or phrases from another language.
HTML
<p>Add the <b>levain</b> to the flour and water.</p>
<p>The recipe calls this step <i lang="fr">autolyse</i>.</p>

Use the test: would you change your tone of voice when reading this aloud? If yes, use em. Is it urgent or critical? Use strong. Is it only a different style of text? Use i or b, or a span with CSS.

Highlighting: mark

mark highlights text because of its relevance in the current context, such as search terms in results or the part of a quote you are discussing.

HTML
<p>Results for "rye": Light <mark>rye</mark> loaf, 800g.</p>

Do not use mark just to make something yellow for decoration.

Code and computer text

ElementUse forExample
codeA fragment of computer code<code>console.log()</code>
kbdKeyboard or other user input<kbd>Ctrl</kbd>+<kbd>S</kbd>
sampSample output from a program<samp>File saved.</samp>
varA variable in maths or code<var>x</var> + 2
HTML
<p>Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save. The editor replies <samp>Saved</samp>.</p>
<p>Call <code>document.querySelector()</code> to find an element.</p>

For a block of code, nest code inside pre. Escape any < and & in the code with character references:

HTML
<pre><code><p class="intro">Hello</p></code></pre>

Abbreviations: abbr

abbr marks an abbreviation or acronym. The optional title attribute gives the expansion:

HTML
<p>Write your pages in <abbr title="HyperText Markup Language">HTML</abbr>.</p>

The title appears as a tooltip for mouse users, but it is not available to touch or keyboard users, and screen readers handle it inconsistently. The most reliable approach is to spell out the term in the text the first time it appears:

HTML
<p>HyperText Markup Language (<abbr>HTML</abbr>) describes page content.</p>

Dates and times: time

time represents a date, time or duration. The datetime attribute holds a machine-readable version, while the content can be written however suits your readers:

HTML
<p>Classes start on <time datetime="2026-11-07">Saturday 7 November</time>.</p>
<p>Doors open at <time datetime="09:30">half past nine</time>.</p>
<p>The class lasts <time datetime="PT3H">three hours</time>.</p>
<p>Posted <time datetime="2026-10-16T14:00Z">16 October 2026</time>.</p>

Search engines, browser extensions and scripts can read the datetime value without guessing your date format. Use ISO 8601 formats: YYYY-MM-DD for dates, HH:MM for times, and PT durations such as PT3H30M.

Quotations and citations

  • q marks a short inline quotation. Browsers add quotation marks for you.
  • blockquote marks a longer quotation as its own block.
  • cite marks the title of a work, such as a book, film or article, not the person being quoted.
HTML
<p>As the label says, <q>best eaten within two days</q>.</p>

<blockquote cite="https://example.com/review">
  <p>The best croissant in the city.</p>
</blockquote>
<p>From a review in <cite>The Bristol Food Guide</cite>.</p>

Edits, small print and other elements

ElementMeaning
del and insText removed from and added to a document, for example a price change
sContent that is no longer accurate or relevant
smallSide comments and small print, such as legal notes
sub and supSubscript and superscript, as in H₂O or footnote markers
dfnThe defining instance of a term
dataContent with a machine-readable value, such as a product code
spanNo meaning at all; a hook for CSS or JavaScript
HTML
<p>Price: <del>£6.00</del> <ins>£4.50</ins></p>
<p>A <dfn>levain</dfn> is a portion of starter mixed for one bake.</p>
<p>Water is H<sub>2</sub>O.</p>
<p><small>Prices correct at time of publishing.</small></p>

Some elements change how screen readers behave in some combinations, and support varies. Never let a meaning depend only on styling such as strikethrough. In the price example, consider adding visible words such as "was" and "now".

When nothing fits: span

If no element describes the meaning, use span. It has no semantics, so it is safe for purely visual styling:

HTML
<p>Open <span class="highlight-day">every day</span> except Christmas.</p>

Summary

  • strong is importance, em is spoken emphasis; b and i are styled text without extra importance.
  • mark highlights relevance, not decoration.
  • Use code, kbd, samp and var for computer text, and pre with code for code blocks.
  • Use time with a datetime value, and spell out abbreviations on first use.
  • Choose elements for meaning, style them with CSS, and fall back to span when nothing fits.

Further reading