jump

HTML: The Markup 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.
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 = normal character data #
Advisory information associated with the element.

8.2. Event-handler attributes # T

onabort = string NEW #
Load of element was aborted by the user.
onblur = string #
Element lost focus.
oncanplay = string 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 = string 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 = string #
User committed a change to the value of element (form control).
onclick = string #
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 = string NEW #
User requested the context menu for element.
ondblclick = string #
User clicked pointer button twice over element, or otherwise activated the pointer in a manner that simulates such an action.
ondrag = string NEW #
User is continuing to drag element.
ondragend = string NEW #
User ended dragging element.
ondragenter = string NEW #
User’s drag operation entered element.
ondragleave = string NEW #
User’s drag operation left element.
ondragover = string NEW #
User is continuing drag operation over element.
ondragstart = string NEW #
User started dragging element.
ondrop = string NEW #
User completed drop operation over element.
ondurationchange = string NEW #
The DOM attribute duration on the video or audio element has been updated.
onemptied = string NEW #
The video or audio element has returned to the uninitialized state.
onended = string NEW #
The end of the video or audio element has been reached.
onerror = string NEW #
Element failed to load properly.
onfocus = string #
Element received focus.
onformchange = string NEW #
User committed a change to the value of a form control in the form to which the element belongs.
onforminput = string NEW #
User changed the value of a form control in the form to which the element belongs.
oninput = string #
User changed the value of element (form control).
oninvalid = string NEW #
Element (form control) did not meet validity constraints.
onkeydown = string #
User pressed down a key.
onkeypress = string #
User pressed down a key that is associated with a character value.
onkeyup = string #
User released a key.
onload = string #
Element finished loading.
onloadeddata = string NEW #
UA can render the video or audio element at the current playback position for the first time.
onloadedmetadata = string NEW #
UA has just determined the duration and dimensions of the video or audio element.
onloadstart = string NEW #
UA has begun looking for media data in the video or audio element.
onmousedown = string #
User pressed down pointer button over element.
onmousemove = string #
User moved mouse.
onmouseout = string #
User moved pointer off boundaries of element.
onmouseover = string #
User moved pointer into boundaries of element or one of its descendant elements.
onmouseup = string #
User released pointer button over element.
onmousewheel = string #
User rotated wheel of mouse or other device in a manner that emulates such an action.
onpause = string NEW #
User has paused playback of the video or audio element.
onplay = string NEW #
UA has initiated playback of the video or audio element.
onplaying = string NEW #
Playback of the video or audio element has started.
onprogress = string NEW #
UA is fetching media data for the video or audio element.
onratechange = string NEW #
Either the DOM attribute defaultPlaybackRate or the DOM attribute playbackRate on the video or audio element has been updated.
onreadystatechange = string NEW #
Element and all its subresources have finished loading.
onreset = string #
The form element was reset.
onscroll = string #
Element or document view was scrolled.
onseeked = string NEW #
The value of the IDL attribute seeking changed to false (a seek operation on the video or audio element ended).
onseeking = string 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 = string #
User selected some text.
onshow = string NEW #
User requested the element be shown as a context menu.
onstalled = string NEW #
UA is attempting to fetch media data for the video or audio element, but that data is not forthcoming.
onsubmit = string #
The form element was submitted.
onsuspend = string 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 = string 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 = string NEW #
Either the DOM attribute volume or the DOM attribute muted on the video or audio element has been changed.
onwaiting = string 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.