HTML <mark> Tag

Our goal in this chapter is to cover the learning requirements by studying Tag mark with examples.

The HTML <mark> tag is used to highlight text within a document or web page. When you wrap text in the <mark> tag, it will be displayed with a yellow background color by default, indicating that it is highlighted.

A text can be highlighted in the following ways:

Example: 

<!DOCTYPE html> <html> <body> <p>Please come home at<mark>5 pm</mark> we have to get to the party.</p> </body> </html>

Here is another example of the mark tag:

Example: 

<!DOCTYPE html> <html> <body> <p>In the <mark>Industrial Revolution</mark> of the 18th century, the mechanization of the textile industry in Great Britain led to significant economic growth.</p> </body> </html>

The mark tag also be style by using CSS properties:

Example: 

<!DOCTYPE html> <html> <head> <style> mark { background-color: black; color: white; } </style> </head> <body> <p>In the <mark>Industrial Revolution</mark> of the 18th century, the mechanization of the textile industry in Great Britain led to significant economic growth.</p> </body> </html>


Tag mark Usage

A Tag mark <mark> specifies the content that shall be highlighted or marked.

Here are some common uses for the <mark> tag:

  1. You can use the <mark> tag to draw attention to important information or to highlight key points in a document, making it easier for users to find and understand.
  2. When quoting text from another source, you can use the <mark> tag to indicate the portion of text that you are highlighting or referencing.
  3. The <mark> tag can be used to highlight search terms or keywords within search results, making it easier for users to find the information they are looking for.
  4. When adding notes or annotations to a document, you can use the <mark> tag to highlight the specific text that the note pertains to.
  5. When editing or proofreading text, you can use the <mark> tag to highlight sections of text that need to be revised or corrected.

Attributes

Global

The Tag mark <mark> is also compatible with Global Attributes in HTML.

Event

The Tag <mark> is also compatible with Event Attributes in HTML.


Pre Defined CSS

The following values are set by default for the <mark> element in almost all browsers:

mark {
background-color: yellow;
color: black;
}

Browser Compatibility

Numbers in the table indicate which browser version was the earliest to include the element.

Element
<mark>6.09.04.05.011.1

HTML <mark> Tag Benefits

Here are some benefits of using the <mark> tag:

  • The <mark> tag provides visual cues for users who rely on screen readers or other assistive technologies to navigate the web.
  • By highlighting important text, the <mark> tag makes it easier for users to quickly scan and understand the content on a page.
  • Search engines use the <mark> tag to identify and rank important keywords on a page, which can improve the page’s visibility in search results.
  • The <mark> tag can be styled using CSS to match the design of a website, allowing developers to create visually appealing and effective highlighting.
If you find this article informative, do leave your reaction below in order to appreciate our efforts or to suggests some feedback for the improvement of this site.
We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *