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

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

Mobile browser support

Browser image
Chrome
All
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
All

Latest Coupon Found:

Verified STAFF PICK

TOP-RATED CODING COURSES

Learn the skills of tomorrow

The best time to learn programming is now - follow this link to access 100+ coding courses and enjoy learning at a very low cost!

Expiration date: 15/05/2021
2287 People Used
Only 92 Left
Rating
5.0