Problem Statement
What does the <mark> element do?
Explanation
The mark element highlights text for reference or notation purposes. It represents text marked or highlighted for relevance in a particular context. By default, browsers display mark with a yellow background, like a highlighter. Use mark for search results highlighting, indicating important text in quotations, or drawing attention to specific content. It is different from strong or em which indicate importance or emphasis. Mark is about highlighting for user reference. For example, highlighting search terms in results, showing relevant passages in quoted text, or indicating changes in document comparisons. Using mark appropriately improves user experience by visually calling attention to relevant content. It has semantic meaning beyond just styling.
Code Solution
SolutionRead Only
<!-- Search results highlighting --> <p>We found results for <mark>JavaScript</mark>:</p> <article> <h2>Learning <mark>JavaScript</mark></h2> <p><mark>JavaScript</mark> is a programming language...</p> </article> <!-- Highlighting in quoted text --> <blockquote> <p>To be or not to be, <mark>that is the question</mark>.</p> </blockquote> <!-- Indicating relevance --> <p>Important dates: <mark>January 15</mark> - Registration deadline </p> <!-- Document comparison --> <p>Original: The product costs $100</p> <p>Updated: The product costs <mark>$89</mark></p>
Practice Sets
This question appears in the following practice sets:
