Description
The HTML element <mark>
is used to define a marked text, which is rendered and displayed as a highlighted text on browsers with a yellow background.
The below table summarizes its usage.
Usage Details | |
Parent Elements | <body> |
Placement | It is displayed as an Inline element. |
Contents | It can contain Inline elements and text. |
Tags | Both the opening and closing tags are required. |
Versions | HTML 5 |
Syntax
Here is the basic syntax of the <mark>
element.
<mark>...</mark>
Examples
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element mark</title>
</head>
<body>
<p>This paragraph contains a <mark>highlighted</mark> text.</p>
</body>
</html>
Attributes
The following table shows the list of supported and unsupported attributes for the <mark>
element.
Attribute Type | Details |
Element-Specific Attributes | The tags <mark> doesn't have any element-specific attributes. |
Global Attributes | Like all other HTML tags, the tag <mark> supports the HTML Global Attributes. |
Event Attributes | The tags <mark> also supports the HTML Event Attributes. |
Browser Compatibility
The tags <mark>
is supported in all modern browsers.
- Google Chrome 6+
- Internet Explorer or Edge 9+
- Firefox 4+
- Apple Safari 5+
- Opera 11.1+