HTML Tags

HTML <mark> Tag

The <mark> tag in HTML is used to highlight text, typically to indicate relevance or search results.
Browsers usually render it with a yellow background by default.
It is an inline element and does not change the text’s semantic importance beyond visual highlighting.

Syntax

<mark>Highlighted text here</mark>

Attribute

AttributeDescription
classAssigns one or more class names for styling.
idAssigns a unique identifier to the highlighted text.
styleAdds inline CSS styles to customize appearance.
titleProvides additional information as a tooltip.

Example

<!DOCTYPE html>
<html>
<head>
  <title>MARK Tag Example</title>
  <style>
    .highlighted {
      background-color: #ffeb3b;
      color: #000;
      padding: 2px 4px;
      border-radius: 2px;
    }
  </style>
</head>
<body>
  <h1>HTML &lt;mark&gt; Tag Example</h1>
  <p>
    This is an example of <mark class="highlighted" id="search-term" title="Highlighted Text">highlighted text</mark> in a paragraph.
  </p>
  <p>
    Example: The keyword <mark>HTML tutorial</mark> was found in the search results.
  </p>
</body>
</html>

Output

Browser Output

Use our TryIt Editor to see the output.

Browser Support

Chrome
Chrome
Firefox
Firefox
Edge
Edge
Safari
Safari
Opera
Opera
IE
IE9+
✅Yes✅Yes✅Yes✅Yes✅Yes✅Yes

The <mark> tag visually highlights text, making it stand out, typically with a yellow background.
It is commonly used to indicate search keywords or important passages.

Notes

  • <mark> is an inline element and preserves surrounding text flow.
  • The default highlight color can be changed using CSS for background and text color.
  • It is semantic for highlighted content, useful for marking relevant information or search results.
  • Avoid overusing <mark> to prevent visual clutter.

Conclusion

The <mark> tag is a visual highlighting element that draws attention to important text or search results.
It improves readability and focus without changing the semantic importance of the surrounding content.

Sign In Form

User your email and password to singn in

Don’t have an account, signup here : 

HTML5 & CSS3

Tools and Tutorials

Want a Website

Want a website for your business ?

Please fill out the details below, so we can reach out to you.

Registration Form

Signup to track your record and much more.

We have sent you an email with a registration link. Please click the link to verify your email address, or enter the 6-digit OTP provided in the email.

Didn't receive the OTP. Regenerate OTP Resend