Global attributes are attributes common to all HTML elements; they can be used on all elements, though they may have no effect on some elements.
Global attributes may be specified on all HTML elements, even those not specified in the standard. That means that any non-standard elements must still permit these attributes, even though using those elements means that the document is no longer HTML5-compliant. For example, HTML5-compliant browsers hide content marked as <foo hidden>…</foo>
, even though <foo>
is not a valid HTML element.
In addition to the basic HTML global attributes, the following global attributes also exist:
-
xml:lang
andxml:base
— these are inherited from the XHTML specifications and deprecated, but kept for compatibility purposes. - The ARIA
role
attribute and the multiplearia-*
states and properties, used for ensuring accessibility. - The event handler attributes:
onabort
,onautocomplete
,onautocompleteerror
,onblur
,oncancel
,oncanplay
,oncanplaythrough
,onchange
,onclick
,onclose
,oncontextmenu
,oncuechange
,ondblclick
,ondrag
,ondragend
,ondragenter
,ondragleave
,ondragover
,ondragstart
,ondrop
,ondurationchange
,onemptied
,onended
,onerror
,onfocus
,oninput
,oninvalid
,onkeydown
,onkeypress
,onkeyup
,onload
,onloadeddata
,onloadedmetadata
,onloadstart
,onmousedown
,onmouseenter
,onmouseleave
,onmousemove
,onmouseout
,onmouseover
,onmouseup
,onmousewheel
,onpause
,onplay
,onplaying
,onprogress
,onratechange
,onreset
,onresize
,onscroll
,onseeked
,onseeking
,onselect
,onshow
,onsort
,onstalled
,onsubmit
,onsuspend
,ontimeupdate
,ontoggle
,onvolumechange
,onwaiting
.