Attributes

HTML attributes modify HTML elements.

Syntax

attribute-name="attribute-value"

Global

Name Value Description
accesskey key label list 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
class tokens Name of a classification, or list of names of classifications, to which the element belongs
contenteditable true | false | empty Specifies whether the contents of the element are editable - HTML5
contextmenu IDREF Identifies a menu with which to associate the element as a context menu - HTML5
dir ltr | rtl Specifies the element's text directionality
draggable true | false Specifies whether the element is draggable - HTML5
hidden hidden | empty Specifies that the element represents an element that is not yet, or is no longer, relevant - HTML5
id ID Unique identifier for the element
lang language tag Specifies the primary language for the contents of the element and for any of the element's attributes that contain text
onabort string Handles the event when the download is aborted by the user
onblur string Handles the event losing focus
oncanplay string Handles the event when the user agent can resume playback of the media data, but estimates that if playback were to be started now, the media resource could not be rendered at the current playback rate up to its end without having to stop for further buffering of content
oncanplaythrough string Handles the event when the user agent estimates that if playback were to be started now, the media resource could be rendered at the current playback rate all the way to its end without having to stop for further buffering
onchange string Handles the event when the user commits a value change
onclick string Handles the event when the user clicks the mouse
oncontextmenu string Handles the event when the user requests their context menu
ondblclick string Handles the event when the user double-clicks the mouse
ondrag string Handles the event when the drag is in progress
ondragend string Handles the event when the drag is completed
ondragenter string Handles the event when the drag object enters an area
ondragleave string Handles the event when the drag object leaves an area
ondragover string Handles the event when the drag object is over an area
ondragstart string Handles the event when the drag is initiated
ondrop string Handles the event when the drag object is released
ondurationchange string Handles the event when the duration attribute has just been updated
onemptied string Handles the event when a media element whose networkState was previously not in the NETWORK_EMPTY state has just switched to that state (either because of a fatal error during load that's about to be reported, or because the load() method was invoked while the resource selection algorithm was already running)
onended string Handles the event when playback has stopped because the end of the media resource was reached
onerror string Handles the event when network and script errors occur
onfocus string Handles the event gaining focus
onformchange string Handles the event when the user commits a value change to a control on the form
onforminput string Handles the event when the user changes the value of a control on the form
oninput string Handles the event when the user changes the value
oninvalid string Handles the event during form validation if they do not satisfy their constraints
onkeydown string Handles the event when the key is down
onkeypress string Handles the event when the key is pressed
onkeyup string Handles the event when the key is up
onload string Handles the event when the document has finished loading; fired at an element containing a resource (e.g. img, embed) when its resource has finished loading
onloadeddata string Handles the event when the user agent can render the media data at the current playback position for the first time
onloadedmetadata string Handles the event when the user agent has just determined the duration and dimensions of the media resource
onloadstart string Handles the event when the user agent begins looking for media data, as part of the resource selection algorithm
onmousedown string Handles the event when the user presses the mouse button
onmousemove string Handles the event when the user moves the mouse
onmouseout string Handles the event when user moves the mouse icon outside the object
onmouseover string Handles the event when the user moves the mouse icon over the object
onmouseup string Handles the event when the user releases the mouse button
onmousewheel string Handles the event when the user moves the mouse wheel
onpause string Handles the event when playback has been paused. Fired after the pause method has returned
onplay string Handles the event when playback has begun. Fired after the play() method has returned
onplaying string Handles the event when playback has started
onprogress string Handles the event when the user agent is fetching media data
onratechange string Handles the event when either the defaultPlaybackRate or the playbackRate attribute has just been updated
onreadystatechange string Handles the event when it finishes parsing and again when all its subresources have finished loading
onscroll string Handles the event when it is scrolled
onseeked string Handles the event when the seeking IDL attribute changed to false
onseeking string Handles the event when the seeking IDL attribute changed to true and the seek operation is taking long enough that the user agent has time to fire the event
onselect string Handles the event when it is selected
onshow string Handles the event when it is shown as a context menu
onstalled string Handles the event when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming
onsubmit string Handles the event when it is submitted
onsuspend string Handles the event when the user agent is intentionally not currently fetching media data, but does not have the entire media resource downloaded
ontimeupdate string Handles the event when the current playback position changed as part of normal playback or in an especially interesting way, for example discontinuously
onvolumechange string Handles the event when either the volume attribute or the muted attribute has changed. Fired after the relevant attribute's setter has returned
onwaiting string Handles the event when playback has stopped because the next frame is not available, but the user agent expects that frame to become available in due course
spellcheck true | false | empty Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking - HTML5
style string Specifies zero or more CSS declarations that apply to the element
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

External

W3C HTML 4.01 Specification

W3C HTML 4.01 Specification Index

W3C HTML5

W3C HTML5 Index

W3C HTML 5.1

W3C HTML 5.1 Index