HTML Mark Tag

In HTML, the <mark> is used to highlight or mark the portion of text in order to show the importance of the text.

  • It is recommended not to use <mark> tag to highlight the syntax instead use <span> tag with its CSS Properties.

  • The <mark> tag is used to show the text or content of the document relevant to the user's current activity.

  • When the <mark> tag is used inside <q> or <blockquote> tag then it generally indicates the text which is of special interest; though it does not mark the original document.

  • The <mark> tag perform similarly like you are marking with a highlighter in your book the content of your interest

HTML <mark> Tag Syntax and Usage

The <mark> tag requires the start(opening) tag and end(closing) tag. The basic example of the same is given below:

<mark>
...content here
</mark>

HTML <mark> Tag Basic Example

Below we have a basic example for this tag.

Given below is the usage of <mark> tag to mark the search result within a passage

<p><mark class="match">HTML</mark> is known as Hypertext Markup Language.</P>
<p><mark class="match">HTML</mark> is used to create static web pages

HTML <mark> Tag Attributes

This attribute does not have specific attributes, the <mark> tag supports global and event attributes.

Default CSS Settings of HTML <mark> Tag

mark {
  background-color: yellow;
  color: black;
}

Browser Support for HTML5<mark> tag

Following browsers support this attribute:

  • Firefox 4+

  • Google Chrome 6+

  • Internet Explorer 9+

  • Apple Safari 5+

  • Opera 11.1+