Beginner LevelHTML & Semantic Web
What is the semantic purpose of the <mark> HTML tag?
❓ Interview Prompt: Explain <mark> element, highlighting search result matches, and screen reader announcements.
The '<mark>' HTML element represents text highlighted for reference or notation purposes due to its relevance in another context (such as highlighting search query terms inside search result snippets).
Default Style:
Browsers render '<mark>' text with a yellow background fill ('background-color: mark; color: marktext').
Code Implementation Example
html
<p>
Search results for "accessibility": Semantic HTML improves
<mark>accessibility</mark> for screen reader users.
</p>💡Highlighting matched search terms using semantic mark tag.
🎯 Interview Key Takeaway
Use <mark> to highlight text relevant to another context, such as search result query matches.
#mark tag#Highlighting#Semantics#Beginner
Back to all HTML & Semantic Web Questions→