

- 1HTML Forms
- 2HTML form Tag
- 3HTML Input Types
- 4HTML Labels and Placeholders
- 5HTML Select Dropdown
- 6HTML Checkbox
- 7HTML Radio Buttons
- 8HTML Textarea
- 9HTML Submit and Reset Buttons
- 10HTML Form Validation
- 11HTML Required Fields
- 12HTML Input Pattern Attribute
- 13HTML min and max Attribute
- 14HTML Form Action and Method
- 15HTML Fieldset and Legend
- 16HTML Form Advanced Controls
- 17HTML Date Picker
- 18HTML Range Slider
- 19HTML Color Picker
- 20HTML File Upload
- 21HTML Datalist
- 22HTML Autofocus and Autocomplete




- 1Accessibility in HTML
- 2Alt Text for Images
- 3ARIA Roles in HTML
- 4Semantic HTML for Accessibility
- 5Keyboard Navigation in HTML
- 6Screen Reader Accessibility in HTML
- 7HTML Best Practices for SEO
- 8HTML Meta Tags
- 9HTML Headings Best Practices
- 10Title and Meta Description Tags in HTML
- 11HTML Linking Structure
- 12HTML Clean Code Standards

mark Element in HTML
Highlight Important or Search-Related Text
HTML <mark>
Element: Shine a Light on Key Text
Sometimes, you want to draw the reader’s eye to something important — a keyword, a match, a standout term. The <mark>
element lets you do just that. It gives text semantic emphasis and visual highlighting, especially useful for search interfaces and annotations.
What Is the <mark>
Element?
The <mark>
element highlights text that is relevant to a user’s current action or context — like search results or selected keywords. By default, browsers render it with a yellow background, similar to a highlighter pen.
Basic Syntax
<p>My favorite fruit is <mark>banana</mark>. I eat one every day!</p>
My favorite fruit is banana. I eat one every day!
The word "banana" stands out visually — and semantically.
Common Use Cases
- Highlighting search result matches
- Annotating or emphasizing passages in a document
- Marking important changes or new content
- Temporarily drawing attention to key phrases
Example: Search Results Page
<p>Search results for “apple”:</p>
<p>The <mark>apple</mark> is sweet and crisp.</p>
Search results for “apple”:
The apple is sweet and crisp.
Example: Contextual Highlight in an Article
<article>
<h2>Benefits of Cherries</h2>
<p>Cherries are <mark>rich in antioxidants</mark> and help reduce inflammation.</p>
</article>
Styling with CSS
The <mark>
tag comes with default yellow background styling, but you can customize it with CSS:
mark {
background-color: #ffe066;
padding: 0.1em 0.3em;
border-radius: 4px;
}
Accessibility and Semantics
Screen readers may announce <mark>
with emphasis or a tonal cue. Use it only when you want to highlight text that has a reason for standing out in the current context — not just to make something look yellow.
Best Practices
- Use
<mark>
to highlight relevant user-focused text - Avoid using it purely for visual effect —
<strong>
or<em>
might be better for emphasis - Keep highlights short and context-aware
Summary
The <mark>
element helps you highlight what matters — whether it’s a fruit name in a recipe search or a key update in your blog. You’ve now learned how to:
- Use
<mark>
for semantic text highlighting - Support search, annotation, and real-time emphasis
- Style it with CSS and keep it accessible
What’s Next?
Next, we’ll wrap up with a review of how semantic HTML improves structure, accessibility, and SEO — bringing it all together for better web design.