Weekly Webtips
Published in

Weekly Webtips

How to Highlight Text in HTML?

Hello everyone, Today in this post I will tell you how you can highlight text in HTML. So set tight and grab a cup of coffee.

To highlight text in HTML we need to wrap that piece of text in <mark> tag.

The <mark> HTML element represents text which is marked or highlighted for reference or notation purposes, due to the marked passage's relevance or importance in the enclosing context.

Let’s see at the example below:

<p>This is a sample <mark> paragraph </mark> </p>

The text “paragraph” will be highlighted because it is inside the<mark> tag.

By default the highlighted color is yellow, but don’t worry we can change it from CSS like below:


The <mark> tags can be useful but only for content that you control. If you want to let users make their own highlights, using <mark> can potentially break the markup.

I hope so you liked it, show some love and support in the comments below.

Connect with me on Twitter

Happy Coding…..




Explore the world of web technologies through a series of tutorials

Recommended from Medium

Conquering the divided

Event Detection: From DTM to Launch

Recursion for beginners.

Zuki Moba IDO Allocations + Details

How a Zero-bug Policy Doubled Our Development Velocity

Unit testing in Flutter: bloc pattern

Unmasking Communication Between an Android App and its Server(SSL PINNING BYPASS)

How to convert CSV to Excel XLSX Spreadsheet in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Hilal Ahmad

Hilal Ahmad

A Software Engineer with 3 years of experience in Software development. Visit me at https://about.me/hilalahmad

More from Medium

Our Experience Learning Frontend Web development (HTML, CSS, Tailwind and JavaScript) in Side…

My first days using Linux

Web Development — Front-end, Back-end or Full Stack???

What Is JSON??