The mark tag or <mark> tag in HTML is used to highlight a text that can be inside of any other HTML element.
So far we never had any dedicated tags in HTML that can highlight texts. With the mark tag in semantic tags we can highlight a text in HTML.
Just note that mark tag uses default color as yellow for highlighting the texts. However, we can change the default color to some other color in CSS properties.
Let us see the mark tag in use with the below example.
<html> <body> <p>This is the <mark>highlighted</mark> content</p> </body> </html>
So, if you look at the above code. We have used the mark tag to mark a text,
<mark>highlighted</mark>
for the below paragraph.
<p>This is the <mark>highlighted</mark> content</p>
Now, if you look at the above output. The text is marked with the yellow color which is the default color for mark tag.
Now, let us see how can we change the default color using CSS properties.
<html> <body> <p>This is the <mark style="background-color: green;">highlighted</mark> content</p> </body> </html>
So, if you look the above code, we have changed the color to green using the background-color property of CSS.
<mark style="background-color: green;">
And the color got changed from yellow to green.