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> 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
By default the highlighted color is yellow, but don’t worry we can change it from CSS like below:
<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