Code has been added to clipboard!

Make HTML Highlight Text Using mark Tags

Reading time 1 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML Highlight Text: Main Tips

  • HTML mark tags are used to highlight important portions of text.
  • It was newly introduced in HTML5.
  • You must use both starting and ending HTML highlight text tags.

Using mark Tags

To make HTML highlight text, you need to surround it with <mark> tags:

Example
<p>The mark tag is <mark>useful</mark> when you need to highlight important information.</p>

Understanding how to highlight text in HTML comes in handy when you need to convey that some content has more relevance than the rest. The most common case of using it is highlighting search results.

The browser will display the content of HTML mark tags using these CSS settings:

Example
mark { 
    background-color: yellow;
    color: black;
}

Note: most screen readers don't announce the presence of HTML mark element by default. You can change it using the CSS content property.

Browser support

Chrome
All
Edge
All
Firefox
4+
IE
9+
Opera
11+
Safari
All

Mobile browser support

Chrome
All
Firefox
4+
Opera
All
Safari
All