My Computer Tips

Home | About | Categories | All Tips & Tutorials

Use the HTML <mark></mark> tag to highlight text on your webpages

ID: 322

Category: HTML

Added: 2nd of October 2022

Views: 1,067

To highlight text on a webpage you can the HTML <mark></mark> tag

Example:
Use the <mark></mark> tag in HTML to highlight text on your webpages.

By default highlighted text will have a yellow background. If you want to change this you just need to add some css to your HTML code, like the example below.

Create a new file on your Desktop named mark.html, copy and paste the code below then save the file. Launch the file in your browser.

<style>
mark
{
background:green;
}
</style>
Use the <mark></mark> tag in HTML to <mark>highlight</mark> text on your <mark>webpages</mark>

Related Tips & Tutorials

Using the HTML <kbd></kbd> tag to show keyboard shortcuts in your webpages