Dhairya Shah
Dhairya Shah's Blog

Dhairya Shah's Blog

Highlight text in HTML

Highlight text in HTML

Dhairya Shah's photo
Dhairya Shah
·Aug 27, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

A website's main and most important component is text. Reading long texts can be tedious at times, making visitors lazy to read them. Highlighting important text from a large text block is the best way to show it. So, in this article, you will learn about HTML text highlighting.

To highlight the text, we will need of <mark> tag, that highlights the text with the default yellow background, and black text.

How <mark> tag will work:

<p>This is <mark>highlighted text</mark> using mark tag.</p>

Output:

This is highlighted text using mark tag.

It can be even styled,

mark{
  background-color: #7AFEE0;
  font-weight: bold;
}

Here's another example:

Thanks for reading

Follow me on Twitter

Thanks for reading!

 
Share this