🚨 $100K in Sight: Follow Bitcoin’s Final Push Live! TRACK NOW

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.
DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

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