Sub topic 7
Marking up meaning inside text
This chapter assumes you know basic HTML syntax (tags, attributes, nesting) and have used browser developer tools. CSS knowledge helps but is not required.
Meaning versus appearance
Text-level elements (also called inline or phrasing elements) describe the role of a few words inside a paragraph. Browsers give them a default look, but the look is not the point. Bold text can mean "important" or "a product name" or nothing at all. The element you choose should state which one. You can change the appearance with CSS at any time, but the meaning stays in the markup.
Importance and stress
<strong> marks content of strong importance, seriousness, or urgency. <em> marks stress emphasis, the word you would lean on when speaking. Screen readers may change their voice for <em>, and the position of <em> can change the meaning of a sentence.
<p>
<strong>Warning:</strong> do not unplug the device while it updates.
</p>
<p>I did not say <em>he</em> took it.</p>
<p>I did not say he <em>took</em> it.</p>Both <strong> and <em> can be nested to raise the level of importance or stress.
Other text-level elements
| Element | Meaning | Typical use |
|---|---|---|
| `<mark>` | Text highlighted for relevance in the current context | Search terms in results |
| `<code>` | A fragment of computer code | Function names, commands |
| `<kbd>` | User keyboard input | Shortcuts such as Ctrl+S |
| `<abbr>` | An abbreviation or acronym | HTML, WCAG |
| `<q>` | A short inline quotation | A quoted phrase in a sentence |
| `<b>` and `<i>` | Offset text with no added importance or stress | Product names, foreign terms, thoughts |
<p>
Press <kbd>Ctrl</kbd> + <kbd>S</kbd> to save. The
<abbr title="Web Content Accessibility Guidelines">WCAG</abbr>
guide calls <code>alt</code> text a basic requirement.
</p>
<p>Results for <mark>semantic</mark> markup: 12 matches.</p>The title attribute on <abbr> is optional, and many users never see it because it needs a mouse hover. If the expansion matters, write it out in full the first time you use the abbreviation.
Machine-readable values with time
The <time> element pairs human-readable text with a value that software can parse. The datetime attribute holds the machine form.
<p>
The event starts at <time datetime="2026-12-05T18:30">6:30 pm on 5 December</time>
and lasts <time datetime="PT2H">two hours</time>.
</p>The related <data value="..."> element does the same for non-date values, such as a product code.
Common errors
- Using
<strong>or<em>for looks. If you only want bold or italic, use CSS (font-weight,font-style). - Using
<em>to mark a whole paragraph. Stress works on words. A whole paragraph that matters is better handled with a heading or a callout structure. - Using
<code>for any monospace text. Reserve it for actual code. - A malformed
datetime. A value such as30/11/2026is not valid. Use2026-11-30. - Putting block elements inside inline ones. Keep a
<div>out of a<strong>.
Exercise
A recipe says "Bake for 20 minutes. Do NOT open the oven door." The words "Do NOT open the oven door" are styled bold. Which element should wrap them, and how would you write the cooking time so a program can read it?
Show answer
Wrap the warning in <strong>, because it is a serious instruction. Write the time as <time datetime="PT20M">20 minutes</time>.
Exercise
Why is <p><em>Please read the full terms before you continue with the purchase.</em></p> a poor use of <em>?
Show answer
<em> marks stress on specific words, as in speech. Applying it to a whole sentence or paragraph removes that contrast. If the text only needs to look italic, use CSS. If it is important, use <strong>.