HTML Inline Semantics: Mark, Abbreviations and Time
Give short phrases precise meaning
Use mark for text relevant to the current context, small for side comments such as legal notes, s for information no longer accurate, and u for a non-textual annotation such as a spelling mark. These are not interchangeable visual effects.
<p> Search result: <mark>mint</mark> leaves</p><p> <s>Sold out</s> Back in stock.</p><p> <small>Offer ends Friday.</small></p><p> Spelling: <u>recieve</u></p>Each phrase conveys a distinct purpose. Underlining can look like a link, so use u with care.
Define terms and numbers
Use dfn at the point where a term is defined, and abbr for an abbreviation. Its optional title gives the expansion, but important expansions should also appear in visible text. sub and sup represent conventional subscripts and superscripts, such as formulas.
<p> <dfn>Latency</dfn> means a delay.</p><p> World Health Organization ( <abbr title="World Health Organization">WHO</abbr> )</p><p> H <sub>2</sub> O and 3 <sup>2</sup></p>The first sentence defines a term; the other lines expand an abbreviation and show conventional notation.
Provide machine-readable values
time associates human-readable time or date text with a machine-readable value, often using datetime. data links visible text to a value such as a product identifier. ruby with rt adds pronunciation or explanatory annotations; rp supplies fallback parentheses.
<p> Meet on <time datetime="2027-02-03">February 3</time> .</p><p> <data value="P42">Travel mug</data></p><p lang="ja"> <ruby> 山 <rp>(</rp> <rt>やま</rt> <rp>)</rp> </ruby></p>The displayed date and product label remain readable. Software can read their encoded values; ruby supplies a reading for the character.
Practice and next steps
Create a product note with a highlighted search term, a product identifier and a machine-readable delivery date.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Inline meanings — Knowledge Check
Apply the concepts from Inline meanings.
Which element identifies a relevant search match?
Which element supplies an explicit machine-readable date?
Which element is appropriate for the 2 in H2O?
Which element marks the term at its point of definition?
What is the purpose of data value="P42" around a product name?