Warning:
This wiki has been archived and is now read-only.

Attributes/ Global

From HTML Wiki
Jump to: navigation, search

Global Attributes

The following attributes are supported by all HTML elements.

Core Attributes

Table of Core Attributes
name values description
accesskey list of key labels 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 Specifies whether the contents of the element are editable.
contextmenu ID reference The value of the id attribute on the menu with which to associate the element as a context menu.
dir "ltr" or "rtl" Specifies the element’s text directionality.
draggable "true" or "false" Specifies whether the element is draggable.
hidden "hidden" or "" (empty string) or empty 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: 1. must be at least one character long 2. must not contain any space characters
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 [BCP47].
spellcheck "true" or "false" or "" (empty string) or empty 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.

Event-handler Attributes

  • onabort = string
    Load of element was aborted by the user.
  • onblur = string
    Element lost focus.
  • oncanplay = string
    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
    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
    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
    User is continuing to drag element.
  • ondragend = string
    User ended dragging element.
  • ondragenter = string
    User’s drag operation entered element.
  • ondragleave = string
    User’s drag operation left element.
  • ondragover = string
    User is continuing drag operation over element.
  • ondragstart = string
    User started dragging element.
  • ondrop = string
    User completed drop operation over element.
  • ondurationchange = string
    The DOM attribute duration on the video or audio element has been updated.
  • onemptied = string
    The video or audio element has returned to the uninitialized state.
  • onended = string
    The end of the video or audio element has been reached.
  • onerror = string
    Element failed to load properly.
  • onfocus = string
    Element received focus.
  • onformchange = string
    User committed a change to the value of a form control in the form to which the element belongs.
  • onforminput = string
    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
    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 release a key.
  • onload = string
    Element finished loading.
  • onloadeddata = string
    UA can render the video or audio element at the current playback position for the first time.
  • onloadedmetadata = string
    UA has just determined the duration and dimensions of the video or audio element.
  • onloadstart = string
    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
    User has paused playback of the video or audio element.
  • onplay = string
    UA has initiated playback of the video or audio element.
  • onplaying = string
    Playback of the video or audio element has started.
  • onprogress = string
    UA is fetching media data for the video or audio element.
  • onratechange = string
    Either the DOM attribute defaultPlaybackRate or the DOM attribute playbackRate on the video or audio element has been updated.
  • onreadystatechange = string
    Element and all its subresources have finished loading.
  • onscroll = string
    Element or document view was scrolled.
  • onseeked = string
    The value of the IDL attribute seeking changed to false (a seek operation on the video or audio element ended).
  • onseeking = string
    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
    User requested the element be shown as a context menu.
  • onstalled = string
    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
    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
    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
    Either the DOM attribute volume or the DOM attribute muted on the video or audio element has been changed.
  • onwaiting = string
    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).

XML Attributes

  • xml:lang = language tag
    As defined in the XML specification [XML].
    A valid language tag, as defined in [BCP47].
  • xml:space = "preserve"
    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.