The mark tag is used in HTML to highlight relevant text within the HTML page. By default, browsers display text within the <mark>
tag as black with a yellow background.
The <mark>
tag is supported by the following browsers:
Here is the syntax for the <mark>
tag:
<p> This text is <mark>very</mark> important</p>
This results in the following output on the browser:
This text is very important.
Remember: The HTML <mark> element can only be used within the <body> tag.
By default, the <mark>
tag will set the background color to yellow and the text color to black, but this can be edited within the CSS file:
The change in CSS converts the above example into:
This text is very important.
Bold, italics, and other styles can be added within the CSS file.