HTML Highlight Text: Main Tips
- HTML
mark
tags are used to highlight important portions of text. - It was newly introduced in HTML5.
- You must use both starting and ending HTML highlight text tags.
Using mark Tags
To make HTML highlight text, you need to surround it with <mark>
tags:
<p>The mark tag is <mark>useful</mark> when you need to highlight important information.</p>
Understanding how to highlight text in HTML comes in handy when you need to convey that some content has more relevance than the rest. The most common case of using it is highlighting search results.
The browser will display the content of HTML mark
tags using these CSS settings:
Note: most screen readers don't announce the presence of HTML mark element by default. You can change it using the CSS content property.