HTML <mark> Tag

The <mark> tag is used to mark or highlight text. This element adds importance to a fragment of inline text.

HTML Tag

Example

#

A <mark> tag that highlights a text fragment.

Paul Cézanne was a post-impressionist artist.

<p>Paul Cézanne was a <mark>post-impressionist</mark> artist.</p>

Using <mark>

The <mark> tag marks or highlights text.

This element is used to add importance to text or highlight parts of the text.

More Examples

A couple <mark> tags marking text fragments.

Paul Cézanne was a post-impressionist painter. His work laid the foundations of the transition from the 19th-century conception of artistic endeavor to a new and radically different world of art in the 20th century.

<p style="max-width:550px;">
  Paul Cézanne was a <mark>post-impressionist</mark> painter.
  His work laid the foundations of the transition from the
  19th-century conception of artistic endeavor to a 
  <mark>new and radically different world</mark> of art 
  in the 20th century.
</p>

Attributes for <mark>

The <mark> element has no attributes, but it does accept global attributes.
The following are commonly used.

Attribute Value Description
id    value Provides the mark element with a unique identifier.
class    classnames Assigns one or more classnames to the mark element.
style    CSS-values Assigns CSS style values to the mark element.

For additional global attributes see our global attributes list.


Did you know?

Did you know?

The background of <mark> can be changed

By default, the <mark> element highlight color is bright yellow which is generally not desirable.

With the CSS background property, you can adjust the highlight color.

A <mark> tag with a custom highlight color.

Paul Cézanne was a post-impressionist painter.

<p>
   Paul Cézanne was a 
   <mark style="background:lavender;">post-impressionist</mark> painter.
</p>

Browser support

Here is when <mark> support started for each browser:

Chrome
6.0 Sep 2010
Firefox
4.0 Mar 2011
IE/Edge
9.0 Mar 2011
Opera
11.1 Mar 2011
Safari
5.0 Jun 2010

You may also like

Guides