To highlight text in HTML, wrap it in the <mark> element, and to show side comments or fine print, use the <small> element. <mark> highlights text that is relevant in the current context, such as a search match, and browsers show it with a yellow background. <small> represents side comments such as copyright lines and legal notes, and shows text in a smaller size.
This guide covers the meaning of html mark tag and <small>, the default styles, how to customise them with CSS, and how to keep them accessible.
The <mark> element marks text that is highlighted for reference because it is relevant in another context. The standard gives two common cases: a search term inside results, and a part of a quotation that the author wants you to notice.
Browsers apply a yellow background with black text by default. The highlight tells the reader why the text is shown, not that it is more important in the original source. If you want to signal importance, use <strong>.
A frequent pattern wraps matches in <mark> after a user searches:
The code escapes special characters in the term, then rebuilds the content. Setting innerHTML from text that users supply is risky. Here the source is textContent, so the original tags are removed first, but the page text itself might contain characters such as < that become markup. For real applications, build nodes with document.createElement("mark") or use the CSS Custom Highlight API, which highlights ranges without changing the DOM.
The <small> element represents side comments and small print, such as copyright notices, licensing terms, disclaimers and legal restrictions. Before HTML5 it meant only a smaller font size. Now it describes the kind of content, and the smaller size is the default style.
The fine print is visibly smaller, and the markup says it is a side comment. Do not wrap whole paragraphs or important instructions in <small>. Long passages are hard to read, and the element is not meant for headings or main content.
The © in the example is a character reference that displays the copyright symbol.
| Feature | <mark> | <small> |
|---|---|---|
| Purpose | Highlight text relevant in context | Side comments and fine print |
| Default style | Yellow background | Smaller font size |
| Typical use | Search matches, quoted highlights | Copyright, disclaimers, legal notes |
| Changes meaning of the text | Adds relevance | Marks lower prominence |
Both elements can be restyled so they match your brand while keeping their meaning.
Keep the colour contrast between text and background at or above the WCAG ratio of 4.5 to 1 for normal text. A pale yellow with dark text meets that easily, but a light grey <small> on white often does not.
<mark> by default, so do not rely on colour alone. If the highlight carries meaning, add visible text as well.<small>, since low vision users depend on readable sizes.<mark> as a generic yellow background for decoration. Use a <span> with a class.<small> to reduce the size of headings or buttons. Use CSS.<mark> with <strong>, which marks importance.<small> including links and navigation.<mark> is semantic markup that says text is relevant in context. A CSS background is only a visual style. Use <mark> when the meaning applies, and CSS when it is decoration.
No. HTML5 redefined it for side comments and small print. Only using it as a purely visual font-size tool is discouraged.
Yes. Set background-color and color in CSS, and check that the contrast stays high enough to read.
Browsers typically render it one size step smaller than the parent, roughly 83 percent. Set font-size yourself if you need a precise value.
Use <mark> to highlight text that is relevant in the current context, such as search results, and <small> for side comments and legal small print. Each has a default look, a yellow background and a smaller size, that you can change in CSS. Keep contrast high, do not use either for pure decoration, and prefer <strong> for importance.