HTML - <mark>
The HTML Mark Element (<mark>) represents highlighted text, i.e., a run of text marked for reference purpose, due to its relevance in a particular context. For example it can be used in a page showing search results to highlight every instance of the searched-for word.
Examples
Example1
<p>The <mark> element is used to <mark>highlight</mark> text</p>
Result
The <mark> element is used to highlight text
Description
The HTML Mark Element (<mark>) represents highlighted text, i.e., a run of text marked for reference purpose, due to its relevance in a particular context. For example it can be used in a page showing search results to highlight every instance of the searched-for word.
Usage notes:
- In a quotation or another block, the highlighted text typically marks text that is referenced outside the quote, or marked for specific scrutiny even though the original author didn't consider it important.
- In the main text, the highlighted text typically marks text that may be of special relevance for the user's current activity, like search results.
- Do not use the
<mark>
element for syntax highlighting; use the<span>
element for this purpose. - Do not confuse the
<mark>
element with the<strong>
element. The<strong>
element is used to denote spans of text of importance in context of the text, when the<mark>
element is used to denote spans of text of relevance to a different context.
Content categories | Flow content, phrasing content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parent elements | Any element that accepts phrasing content. |
DOM interface | HTMLElement |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 4.0 (2.0) | 9.0 | 11.0 | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | 4.0 (2.0) | ? | ? | ? |
See Also
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<mark>' in that specification. |
Living Standard | |
HTML5 The definition of '<mark>' in that specification. |
Recommendation |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/mark