Trusted answers to developer questions

How to use the HTML mark tag

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

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:

widget

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.

RELATED TAGS

html
tag
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?