Text
Inline formatted elements
Published on
Description
Inline formatting elements convey meaning through text-level semantics. Elements like <mark>, <del>, <ins>, and <s> communicate editorial changes and highlights.
Example
Accessibility
- Most screen readers do not announce
<mark>,<del>,<ins>, or<s>by default. Use CSS-generated content with::before/::afterpseudo-elements to provide screen reader announcements. - Highlighted text (
<mark>) needs 3:1 contrast for the highlight block and 4.5:1 for text within. Do not rely on color alone for distinction. - Use visually-hidden
::before/::aftercontent (e.g. "[start deletion]"/"[end deletion]") to announce editorial marks to assistive technology. - Support Windows High Contrast Mode with system color keywords.
References
- Tweaking Text Level Styles (opens in new tab) — Adrian Roselli
- A Brief Note on Highlighted Text (opens in new tab) — Adrian Roselli
Related
- Inline style elements — for presentational inline elements
Variables
None for inline elements