Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <mark> Tag

The <mark> tag is used to mark or highlight text.

This element adds importance to a fragment of inline text.

Example

#

A <mark> element highlighting a text fragment.

Paul Cézanne was a post-impressionist artist.

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

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?

Changing the <mark> background

By default, the <mark> element highlight color is bright yellow.

This color is generally not desirable.

With CSS background-color, the highlight color can be adjusted.

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-color: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


Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides