jump

HTML: The Markup Language (an HTML language reference)

8. Global attributes # T

This section describes attributes that are common to all elements in the HTML language.

8.1. Core attributes # T

accesskey = list of key labels CHANGED #
A key label or list of key labels with which to associate the element; each key label represents a keyboard shortcut which UAs can use to activate the element or give focus to the element.
An ordered set of unique space-separated tokens, each of which must be exactly one Unicode code point in length.
class = set of space-separated tokens #
A name of a classification, or list of names of classifications, to which the element belongs.
contenteditable = "true" or "false" or "" (empty string) or empty NEW #
Specifies whether the contents of the element are editable.
contextmenu = ID reference NEW #
The value of the id attribute on the menu with which to associate the element as a context menu.
dir = "ltr" or "rtl" or "auto" #
Specifies the element’s text directionality.
draggable = "true" or "false" NEW #
Specifies whether the element is draggable.
dropzone = dropzone value NEW #
Specifies what types of content can be dropped on the element, and instructs the UA about which actions to take with content when it is dropped on the element.

An unordered set of unique space-separated tokens, each of which is a case-insensitive match for one of the following:

copy

Indicates that dropping an accepted item on the element will result in a copy of the dragged data.

move

Indicates that dropping an accepted item on the element will result in the dragged data being moved to the new location.

link

Indicates that dropping an accepted item on the element will result in a link to the original data.

Any string with three characters or more, beginning with the literal string "string:".

Indicates that Plain Unicode string items, of the type indicated by the part of of the keyword after the "string:" string, can be dropped on this element.

Any string with three characters or more, beginning with the literal string "file:".

Indicates that File items, of the type indicated by the part of of the keyword after the "file:" string, can be dropped on this element.

The value must not have more than one of the three tokens "copy", "move", or "link". If none are specified, the element represents a copy dropzone.

hidden = "hidden" or "" (empty string) or empty NEW #
Specifies that the element represents an element that is not yet, or is no longer, relevant.
id = ID #
A unique identifier for the element.
There must not be multiple elements in a document that have the same id value.
Any string, with the following restrictions:

Previous versions of HTML placed greater restrictions on the content of ID values (for example, they did not permit ID values to begin with a number).

lang = language tag #
Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text.
A valid language tag as defined in [BCP 47].
spellcheck = "true" or "false" or "" (empty string) or empty NEW #
Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking.
style = string #
Specifies zero or more CSS declarations that apply to the element [CSS].
tabindex = integer #
Specifies whether the element represents an element that is is focusable (that is, an element which is part of the sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable elements in the document.
title = any value #
Advisory information associated with the element.
translate = "yes" or "no" #
Specifies whether an element’s attribute values and contents of its children are to be translated when the page is localized, or whether to leave them unchanged.

8.2. Event-handler attributes # T

onabort = functionbody NEW #
Load of element was aborted by the user.
onblur = functionbody #
Element lost focus.
oncanplay = functionbody NEW #
The UA can resume playback of media data for this video or audio element, but estimates that if playback were to be started now, the video or audio could not be rendered at the current playback rate up to its end without having to stop for further buffering of content.
oncanplaythrough = functionbody NEW #
The UA estimates that if playback were to be started now, the video or audio element could be rendered at the current playback rate all the way to its end without having to stop for further buffering
onchange = functionbody #
User committed a change to the value of element (form control).
onclick = functionbody #
User pressed pointer button down and released pointer button over element, or otherwise activated the pointer in a manner that emulates such an action.
oncontextmenu = functionbody NEW #
User requested the context menu for element.
ondblclick = functionbody #
User clicked pointer button twice over element, or otherwise activated the pointer in a manner that simulates such an action.
ondrag = functionbody NEW #
User is continuing to drag element.
ondragend = functionbody NEW #
User ended dragging element.
ondragenter = functionbody NEW #
User’s drag operation entered element.
ondragleave = functionbody NEW #
User’s drag operation left element.
ondragover = functionbody NEW #
User is continuing drag operation over element.
ondragstart = functionbody NEW #
User started dragging element.
ondrop = functionbody NEW #
User completed drop operation over element.
ondurationchange = functionbody NEW #
The DOM attribute duration on the video or audio element has been updated.
onemptied = functionbody NEW #
The video or audio element has returned to the uninitialized state.
onended = functionbody NEW #
The end of the video or audio element has been reached.
onerror = functionbody NEW #
Element failed to load properly.
onfocus = functionbody #
Element received focus.
oninput = functionbody #
User changed the value of element (form control).
oninvalid = functionbody NEW #
Element (form control) did not meet validity constraints.
onkeydown = functionbody #
User pressed down a key.
onkeypress = functionbody #
User pressed down a key that is associated with a character value.
onkeyup = functionbody #
User released a key.
onload = functionbody #
Element finished loading.
onloadeddata = functionbody NEW #
UA can render the video or audio element at the current playback position for the first time.
onloadedmetadata = functionbody NEW #
UA has just determined the duration and dimensions of the video or audio element.
onloadstart = functionbody NEW #
UA has begun looking for media data in the video or audio element.
onmousedown = functionbody #
User pressed down pointer button over element.
onmousemove = functionbody #
User moved mouse.
onmouseout = functionbody #
User moved pointer off boundaries of element.
onmouseover = functionbody #
User moved pointer into boundaries of element or one of its descendant elements.
onmouseup = functionbody #
User released pointer button over element.
onmousewheel = functionbody #
User rotated wheel of mouse or other device in a manner that emulates such an action.
onpause = functionbody NEW #
User has paused playback of the video or audio element.
onplay = functionbody NEW #
UA has initiated playback of the video or audio element.
onplaying = functionbody NEW #
Playback of the video or audio element has started.
onprogress = functionbody NEW #
UA is fetching media data for the video or audio element.
onratechange = functionbody NEW #
Either the DOM attribute defaultPlaybackRate or the DOM attribute playbackRate on the video or audio element has been updated.
onreadystatechange = functionbody NEW #
Element and all its subresources have finished loading.
onreset = functionbody #
The form element was reset.
onscroll = functionbody #
Element or document view was scrolled.
onseeked = functionbody NEW #
The value of the IDL attribute seeking changed to false (a seek operation on the video or audio element ended).
onseeking = functionbody NEW #
The value of the IDL attribute seeking changed to true, and the seek operation on the video or audio elements is taking long enough that the UA has time to fire the seeking event.
onselect = functionbody #
User selected some text.
onshow = functionbody NEW #
User requested the element be shown as a context menu.
onstalled = functionbody NEW #
UA is attempting to fetch media data for the video or audio element, but that data is not forthcoming.
onsubmit = functionbody #
The form element was submitted.
onsuspend = functionbody NEW #
UA is intentionally not currently fetching media data for the video or audio element, but does not yet have the entire contents downloaded.
ontimeupdate = functionbody NEW #
The current playback position of the video or audio element changed either as part of normal playback, or in an especially interesting way (for example, discontinuously).
onvolumechange = functionbody NEW #
Either the DOM attribute volume or the DOM attribute muted on the video or audio element has been changed.
onwaiting = functionbody NEW #
Playback of the video or audio element has stopped because the next frame is not yet available (but UA agent expects that frame to become available in due course).

8.3. XML attributes # T

xml:lang = language tag #
As defined in the XML specification [XML].
A valid language tag as defined in [BCP 47].
xml:space = "preserve" or"default" #
As defined in the XML specification [XML].
The xml:space attribute should only be used with documents in the XML syntax; it must not be used in documents in the HTML syntax.
xml:base = URL potentially surrounded by spaces #
As defined in the XML Base specification [XMLBase].
The xml:base attribute should only be used with documents in the XML syntax; it must not be used in documents in the HTML syntax.