<mark> Tag in HTML
The <mark> tag is used to highlight or mark a specific portion of text in a document. The text enclosed within the <mark>
tag is typically rendered with a yellow background, indicating that it is important or has been highlighted for attention.
Key Points on <mark> Tag:
- It highlights text for emphasizing or marking key information.
- Commonly used in search results or to emphasize parts of text in a paragraph.
- Does not apply any special behavior, only visual styling like a background color.
- By default, text is highlighted with a yellow background and black text, but this can be customized using CSS.
Syntax of <mark> Tag:
Syntax Example
<mark>...</mark>
Examples of <mark> Tag Usage:
1. Simple Highlighting of Text
Code Example
<p>The <mark>quick </mark> brown fox jumped over the lazy dog.</p>
Output:
The quick brown fox jumped over the lazy dog.
2. Highlighting Multiple Words
Code Example
<p>Learn <mark>HTML, CSS, and JavaScript </mark>for web development.</p>
Output:
Learn HTML, CSS and JavaScript for web development.
Attributes of <mark> Tag:
- None: The
<mark>
tag does not have any specific attributes.
The <mark>
tag is an essential part of HTML for visually emphasizing parts of text that are crucial for the reader. It is commonly used for highlighting search results, key information, or important terms within text paragraphs.