This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

mark

Summary

Represents a run of text that is contextually-important for some reason, such as text that has been marked or highlighted.

Overview Table

DOM Interface
HTMLElement

Examples

The following example shows the difference between denoting the importance of a span of text (strong) as opposed to denoting the relevance of a span of text (mark). It is an extract from a textbook, where the extract has had the parts relevant to the exam highlighted. The safety warnings, important though they may be, are not relevant to the exam.

<h3>Wormhole Physics Introduction</h3>
<p><mark>A wormhole in normal conditions can be held open for a
maximum of just under 39 minutes.</mark> Conditions that can increase
the time include a powerful energy source coupled to one or both of
the gates connecting the wormhole, and a large gravity well (such as a
black hole).</p>
<p><mark>Momentum is preserved across the wormhole. Electromagnetic
radiation can travel in both directions through a wormhole,
but matter cannot.</mark></p>
<p>When a wormhole is created, a vortex normally forms.
<strong>Warning: The vortex caused by the wormhole opening will
annihilate anything in its path.</strong> Vortexes can be avoided when
using sufficiently advanced dialing technology.</p>
<p><mark>An obstruction in a gate will prevent it from accepting a
wormhole connection.</mark></p>

This example uses mark to indicate the “current” link.

<nav>
  <ul>
    <li><a href="/one">One</a></li>
    <li><mark><a href="/two">Two</a></mark></li>
    <li><a href="/three">Three</a></li>
    <li><a href="/four">Four</a></li>
  </ul>
<nav>

Usage

 The mark element is a phrasing-level element. It must not contain block-level elements, but it can contain other phrasing-level elements.

Notes

The mark element denotes the relevance of a span of text. By default, most browsers render it in black text on a yellow background, but you can change that with CSS.

To indicate importance, use strong; for emphasis, use em.

When used in the main prose of a document, the mark element indicates a part of the document that has been highlighted. When used in a quotation or other block of text (such as an aside), it indicates a highlight that was not originally present but which has been added to bring the reader’s attention to a part of the text. For example, the following are valid uses for the mark element:

  • Bring attention to a particular string of text.
  • Highlight parts of document that match a search string.
  • Enable body text to refer to a specific part of a quotation or code fragment.

Windows Internet Explorer 9. The mark element is only supported for webpages displayed in IE9 Standards mode. For more information, see Defining Document Compatibility.

Related specifications

HTML 5.1
W3C Working Draft
HTML 5
W3C Recommendation

See also

Related articles

HTML

Text

Attributions