HTML mark tag a digital marker


The HTML mark tag is a powerful element that can be used to highlight text

24 Feb, 2021 · 2 min read

Although Mark is also a name, it’s not what this HTML attribute is used for.

Mark describes a text’s highlight, mark it, or highlight it.

How it works:

<p>This is some <mark>highlighted text</mark> using the Mark tag.</p>

And that will result in:

Mark element in HTML result

Custom styling the Mark tag

We can also add custom styling to our mark tag.

mark {
  background: purple;
  color: white;

This will give the following result:

Mark tag with custom CSS

Common use cases for the mark tag

One place where you often find the mark tag being used is on search result pages.

You’ll find the word you were looking for highlighted.

<h3>Search results for "Pikachu"</h3>
<p><mark>Pikachu</mark> is a mouse like Pokémon.</p>
<p>The evolution of Pichu is <mark>Pikachu</mark>.</p>

Search results with mark tag


You can have a play with the following Codepen I set up to showcase the mark tag.

See the Pen HTML mark tag a digital marker by Chris Bongers (@rebelchris) on CodePen.

Browser support

The mark tag is well supported and safe to use.

HTML mark element browser support

Thank you for reading, and let’s connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Spread the knowledge with fellow developers on Twitter
Tweet this tip
Powered by Webmentions - Learn more

Read next 📖

Submit button outside the form

4 Dec, 2022 · 1 min read

Submit button outside the form

Trying out native dialog modals

8 Aug, 2022 · 3 min read

Trying out native dialog modals

Join 2099 devs and subscribe to my newsletter