Mark Element for Highlighting
Uses the mark element to highlight relevant text portions, such as search results or important terms, with semantic meaning and styling.
Code
<p>
Search results for <mark>HTML</mark>:
The <mark>HTML</mark> standard defines the structure of web pages.
Learning <mark>HTML</mark> is the first step in web development.
</p>
<p>
The <mark>critical threshold</mark> is reached when
the temperature exceeds 100°C.
</p>
<blockquote>
<p>
It was the best of times, it was the worst of times,
it was the age of <mark>wisdom</mark>, it was the age
of <mark>foolishness</mark>.
</p>
</blockquote>
<p>
Required fields are marked with <mark>*</mark>.
Please review the <mark>terms and conditions</mark>
before proceeding.
</p>
<style>
mark {
background: #ffeb3b;
color: #000;
padding: 0 2px;
border-radius: 2px;
}
mark.search-result {
background: #fff3cd;
border-bottom: 2px solid #ffc107;
}
mark.important {
background: #ffcdd2;
font-weight: bold;
}
mark::before {
content: "\1F50E";
margin-right: 2px;
}
</style>The <mark> element highlights text that’s relevant in a particular context, like search query matches or important terms. Unlike <strong> (importance) or <em> (stress emphasis), <mark> specifically marks text as relevant or noteworthy. The default styling is yellow background. It’s semantic, so screen readers can announce it. Custom classes can distinguish different highlight types.
Interactive Tools for This Topic
JSON to Zod Schema ConverterInfer typed Zod z.object schemas from JSON payloads locally, supporting nested objects, merged array shapes, enums, nullable fields, and JSDoc comments.JSON Schema ValidatorValidate JSON data against a JSON Schema definition and get detailed error reports. Supports type checking, required fields, and common constraint validation.JSONL / NDJSON InspectorValidate NDJSON and JSON Lines line-by-line, pinpoint syntax errors by line number, analyze key frequencies and types, and export a pretty JSON array.Credit Card Brand DetectorIdentify the card network from a number's prefix and length, validate the Luhn checksum, and show a masked form and the issuer identification number.
Report a problem with this exampleOpens a pre-filled issue on GitHub.