HTML5: Hightlighting text with the <mark> element

This entry is part 15 of 34 in the series HTML5

The <mark> element allows some text in the document to be highlighted. – HTML 5
The default color for the highlighted text is yellow and this default color could be changed using CSS.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title> - HTML 5</title>

<p>Rod Stewart is one of the
    <mark>best-selling music artists of all time</mark>
    , having sold over 100 million records worldwide.


We can make some adjustments to the highlighting color by using CSS:

mark { background-color: lime; font-weight: bold; }

Series Navigation<< HTML5: Marking up date and time with the <time> element
HTML5: Making a form with <fieldset> >>

Leave a comment

Leave a Reply