Table of Contents
INTRODUCTION
The HTML <mark> element is use to mark or highlight text for reference or notation, emphasizing its relevance within the surrounding context. It is generally used for text which can be of particular interest to user. The general use cases of this element are as follows.
- Marking text of user's interest - This element highlights a section of the document that is likely relevant to the user's current task. For example, it can be used to emphasize words that match a search query.
- In Quotations - When included in a quotation (<q>) or block quote (<blockquote>), it typically highlights text of particular interest to user even if the original author did not consider it especially significant. This is similar to using a highlighter in a book to mark text in passage that you find noteworthy.
Display: By default the highlighted text is shown by browser in yellow background, similar to text in book which is highlighted by yellow highlighter pen.
Syntax:
<mark> - - TEXT - - </mark>
Example:
<p>Search results for "car":
A <mark>car</mark>, or an automobile, is a motor vehicle with wheels. Most definitions of <mark>car</mark> state that they run primarily on roads, seat one to eight people, have four wheels, and mainly transport people rather than cargo. There are around one billion <mark>cars</mark> in use worldwide.
</p>
Search results for "car":
A car, or an automobile, is a motor vehicle with wheels. Most
definitions of car state that they run primarily on roads, seat one to
eight people, have four wheels, and mainly transport people rather than cargo. There
are around one billion cars in use worldwide.
Tag Omission
The HTML <mark> element must have both start tag and end tag.
ATTRIBUTES
The <mark> element only has global attributes.
Frequently Asked Questions (FAQ)
What is the color of HTML mark Tag?
How to change the color of HTML mark Tag?
<p>
This is example of text which is marked in <mark style="background-color: green;">green color</mark>.
</p>
This is example of text which is marked in green color.