Skip to article content
FrontendXLesson 03 / 30

Text-level semantics and inline elements

Build semantic, accessible and responsive interfaces from a blank page, and explain why each layout and styling decision works.

beginner · about 25 minutes · 1 exercises

  • Implement

What you will be able to do

#
  • Pick the inline element that carries the correct meaning.
  • Avoid generic span and b where a semantic element exists.

Overview

#

Inline elements carry meaning at the level of a phrase. <strong> marks importance, <em> marks stress emphasis, <time> marks a machine-readable date, <code> marks code, and <abbr> marks an abbreviation. <b> and <i> still exist and carry limited semantics: <b> draws attention without implying importance, and <i> marks an alternate voice such as a technical term or a title. Prefer <strong> and <em> when the meaning is importance or stress.

The distinction between emphasis and importance is real. A screen reader may change pitch for <em> and add stress for <strong>. Using <strong> for every bold word destroys that signal.

snippet.html
<p>
  The invoice is <strong>overdue</strong>. Please pay by
  <time datetime="2026-11-30">30 November 2026</time>.
</p>
<p>
  Run <code>pnpm build</code> to compile the <abbr title="Cascading Style Sheets">CSS</abbr>.
</p>

Attribute values matter too. datetime on <time> must be a valid machine format even when the visible text is human-friendly. title on <abbr> supplies the expansion on hover, but hover-only information is not available to touch and keyboard users, so spell the term out in the surrounding text when it is important.

Links are inline but deserve care. Link text should describe the destination, not say 'click here'. A list of links that all read 'read more' is unusable when a screen reader lists links out of context.

Exercises

#

Reference answers and expected output are authored, not executed in this browser. Nothing you type is run, and there is no Run or Pass control on this page.

  1. Exercise 1Implement

    Rewrite this sentence so the deadline is machine-readable and the warning is genuinely important: 'The report is late. Submit it by 2026-12-01.'

    starter.html
    <p>The report is late. Submit it by 2026-12-01.</p>

    Reveal the reference answer
    reference.html
    <p>The report is <strong>late</strong>. Submit it by <time datetime="2026-12-01">1 December 2026</time>.</p>

    Authored expected output: The word late is wrapped in strong and the date is wrapped in a time element with a valid datetime attribute.

    strong conveys importance and time exposes a machine-readable value while keeping the visible text readable.

Common misconceptions

#
  • strong and b are interchangeable.
  • Link text like 'click here' is fine because the surrounding sentence explains it.

Follow-up practice

#
  • html-css-04-links-images-media

Related resources

#

Your progress

#

Answers, drafts and completion marks are stored only in this browser. Nothing is sent to a server and no account is used.

Verification: authored. Answers and outputs on this page are authored reference material, not executed results.

© 2026 FrontendX. All rights reserved.