Use CSS to highlight text on a page

We can use a span with a specific css class to apply the highlight color. Below, we use the “highlight” class to apply highlighting.

HTML:

Lorem Ipsum is simply <span class="highlight">dummy text of the printing</span> and typesetting industry.

CSS Class:

.highlight{
  background-color: Yellow;
  color: #B22222;
}

Output:
Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.