HTML <mark> tagS2C Home   « HTML <mark> tag

Definition

The <mark> HTML tag is used for defining text to be marked or highlighted.

The <mark> tag was introduced in HTML5.

Example


<p>Today is <mark>Super Monday</mark>.</p>

Today is Super Monday.

Attributes

The following attributes can be used with the <mark> tag.


<mark> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <mark> tag.
<mark> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<mark class="name">Marked Text</mark>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<mark id="name">Marked Text</mark>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<mark style="color:red;">Marked Text</mark>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<mark title="Content info">Marked Text</mark>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<mark accesskey="a">Marked Text</mark>
tabindexSpecifies a tab order for the element.

<mark tabindex="1">Marked Text</mark>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<mark dir="ltr">Marked Text</mark>
<!-- The text will flow from right to left -->
<mark dir="rtl">Marked Text</mark>
langSpecifies a language code for the content of the element.

<mark lang="en">Marked Text</mark>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<mark spellcheck="true">Marked Text</mark> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<mark translate="no">Marked Text</mark> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<mark contenteditable="true">Marked Text</mark> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<mark draggable="true">Marked Text</mark>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<mark hidden>Marked Text</mark> 
<mark hidden="hidden">Marked Text</mark> 
<mark> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<mark oncopy="go()">Marked Text</mark> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<mark oncut="go()">Marked Text</mark>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<mark onpaste="go()">Marked Text</mark>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<mark ondrag="go()">Marked Text</mark>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<mark ondragend="go()">Marked Text</mark>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<mark ondragenter="go()">Marked Text</mark>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<mark ondragleave="go()">Marked Text</mark>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<mark ondragover="go()">Marked Text</mark>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<mark ondragstart="go()">Marked Text</mark>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<mark ondrop="go()">Marked Text</mark>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<mark onblur="go()">Marked Text</mark>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<mark onchange="go()">Marked Text</mark>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<mark oncontextmenu="go()">Marked Text</mark>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<mark onfocus="go()">Marked Text</mark>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<mark oninput="go()">Marked Text</mark>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<mark oninvalid="go()">Marked Text</mark>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<mark onreset="go()">Marked Text</mark>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<mark onselect="go()">Marked Text</mark>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<mark onsubmit="go()">Marked Text</mark>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<mark onkeydown="go()">Marked Text</mark>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<mark onkeypress="go()">Marked Text</mark>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<mark onkeyup="go()">Marked Text</mark>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<mark onabort="go()">Marked Text</mark>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<mark oncanplay="go()">Marked Text</mark>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<mark oncanplaythrough="go()">Marked Text</mark>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<mark oncuechange="go()">Marked Text</mark>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<mark ondurationchange="go()">Marked Text</mark>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<mark onemptied="go()">Marked Text</mark>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<mark onended="go()">Marked Text</mark>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<mark onloadeddata="go()">Marked Text</mark>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<mark onloadedmetadata="go()">Marked Text</mark>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<mark onloadstart="go()">Marked Text</mark>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<mark onpause="go()">Marked Text</mark>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<mark onplay="go()">Marked Text</mark>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<mark onplaying="go()">Marked Text</mark>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<mark onprogress="go()">Marked Text</mark>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<mark onratechange="go()">Marked Text</mark>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<mark onseeked="go()">Marked Text</mark>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<mark onseeking="go()">Marked Text</mark>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<mark onstalled="go()">Marked Text</mark>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<mark onsuspend="go()">Marked Text</mark>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<mark ontimeupdate="go()">Marked Text</mark>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<mark onvolumechange="go()">Marked Text</mark>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<mark onwaiting="go()">Marked Text</mark>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<mark onclick="go()">Marked Text</mark>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<mark ondblclick="go()">Marked Text</mark>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<mark onmousedown="go()">Marked Text</mark>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<mark onmousemove="go()">Marked Text</mark>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<mark onmouseout="go()">Marked Text</mark>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<mark onmouseover="go()">Marked Text</mark>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<mark onmouseup="go()">Marked Text</mark>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<mark onwheel="go()">Marked Text</mark>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<mark onscroll="go()">Marked Text</mark> 
Window - NONE