What Is The HTML <mark> Tag?

What Is The HTML Mark Tag

Date First Published: 22nd January 2024

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 5/10

Learn about what the HTML <mark> tag is in this article.

In HTML, the <mark> tag is used to define highlighted text. It was introduced in HTML 5 and is used to quickly make text of interest or relevance stand out to visitors, like terms in search results matching the user's search query and new content. This allows specific sections of text to be picked out for the reader's attention.

By default, text is highlighted in yellow, but the colour can be changed with CSS. This tag is supported by all major web browsers and contains no unique attributes, but supports all global attributes.

Note: Info Icon

Use the <mark> tag to define text that has relevance, not just to highlight large amounts of text, like syntax highlighting. To style large amounts of text to appear highlighted, use a <span> tag with the proper CSS.


Note: Info Icon

The <mark> tag does not have semantic content. To show the importance of the marked text, use the strong or em tags.


Note: Info Icon

The <mark> tag is not to be confused with the strong tag, which is used to indicate text of importance rather than text of relevance.

Example Of The <mark> Tag

Below is an example of the mark tag. As seen below, the text between the opening and closing tags is highlighted in yellow. Both opening and closing tags are required.

<p><mark>Highlighted text</mark> in a webpage</p>

Highlighted text in a webpage


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.


Comments