HTML - <mark> Tag



HTML <mark> tag is used to mark or highlight text that is important for notation purposes due to the marked passage’s relevance in the enclosing context. By default, the <mark> tag highlights the text in the yellow background, and this tag is new in HTML 5.

Don’t use the <mark> tag for syntax highlighting purposes; instead of <mark>, we can use the <span> tag with appropriate CSS applied to it.

Syntax

<mark> .... </mark>

Attribute

HTML mark tag supports Global and Event attributes of HTML.

Examples of HRML mark Tag

In the bellow examples we will see the different examples of mark elements. Each example will illustrate the use cases of html mark tag.

Marking element using mark Tag

In the following example, we are creating an HTML document and demonstrating the usage of the <mark> tag as follows −

<!DOCTYPE html>
<html>
<body>
   <p> 
      <mark>Tutorialspoint</mark> Simply Easy Learning
   </p>
</body>
</html>

Styling mark Element

Considering the following example, we are using the <mark> tag with CSS properties to change the marked content's color and other properties.

<!DOCTYPE html>
<html>
<head>
   <style>
      mark {
         font-style: italic;
         background-color: green;
         padding: 4px;
      }
   </style>
</head>
<body>
   <p> 
      <mark>Tutorialspoint</mark> Simply Easy Learning</p>
</body>
</html>

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
mark Yes 6.0 Yes 9.0 Yes 4.0 Yes 5.0 Yes 11.1
html_tags_reference.htm
Advertisements