files/en-us/web/html/reference/global_attributes/index.md
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 and xml:base — these are inherited from the XHTML specifications and deprecated, but kept for compatibility purposes.role attribute and the multiple aria-* states and properties, used for ensuring accessibility.anchor {{non-standard_inline}}
id value of the element you want to anchor the positioned element to. The element can then be positioned using CSS anchor positioning.type="password", type="email", or type="url".true or the empty string, which indicates that the element must be editable;false, which indicates that the element must not be editable.plaintext-only, which indicates the element's raw text is editable, but rich text formatting is disabled.ltr, which means left to right and is to be used for languages that are written from the left to the right (like English);rtl, which means right to left and is to be used for languages that are written from the right to the left (like Arabic);auto, which lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then it applies that directionality to the whole element.true, which indicates that the element may be draggedfalse, which indicates that the element may not be dragged.contenteditable mode.[!NOTE] The
item*attributes are part of the WHATWG HTML Microdata feature.
itemprop attribute specified, where an itemprop consists of a name and value pair.itemscope attribute can be associated with the item using an itemref. It provides a list of element ids (not itemids) with additional properties elsewhere in the document.itemscope (usually) works along with itemtype to specify that the HTML contained in a block is about a particular item. itemscope creates the Item and defines the scope of the itemtype associated with it. itemtype is a valid URL of a vocabulary (such as schema.org) that describes the item and its properties context.itemprops (item properties) in the data structure. itemscope is used to set the scope of where in the data structure the vocabulary set by itemtype will be active.xml:lang has priority over it.display: none until opened via an invoking/control element (i.e., a <button> or <input type="button"> with a popovertarget attribute) or a {{domxref("HTMLElement.showPopover()")}} call.roles are added to HTML elements using role="role_type", where role_type is the name of a role in the ARIA specification.slot attribute is assigned to the slot created by the {{HTMLElement("slot")}} element whose name attribute's value matches that slot attribute's value.true, which indicates that the element should be, if possible, checked for spelling errors;false, which indicates that the element should not be checked for spelling errors.0 means that the element should be focusable and reachable via sequential keyboard navigation, but its relative order is defined by the platform convention;tabindex. If several elements share the same tabindex, their relative order follows their relative positions in the document.yes, which indicates that the element will be translated.no, which indicates that the element will not be translated.virtualkeyboardpolicy {{Experimental_Inline}}
contenteditable attribute set).
auto or an empty string, which automatically shows the virtual keyboard when the element is focused or tapped.manual, which decouples focus and tap on the element from the virtual keyboard's state.false, which disables the browser's writing suggestions.true or an empty string, which enables writing suggestions.HTML event handler attributes are discouraged; see HTML attribute reference for how they work.
While the attributes listed below apply to all elements, they are not useful on all elements. For example, onvolumechange HTML attribute is accepted by all elements and attaches an event listener for volumechange, but only media elements will ever receive a volumechange event fired by the browser. For other elements, you can only use {{domxref("EventTarget.dispatchEvent()")}} to manually dispatch one. Some attributes can be specified on {{HTMLElement("body")}}, but they would instead listen to events on window.
onabortonanimationcancelonanimationendonanimationiterationonanimationstartonauxclickonbeforeinputonbeforematchonbeforetoggleonbluroncanceloncanplayoncanplaythroughonchangeonclickoncloseoncommandoncontentvisibilityautostatechangeoncontextlostoncontextmenuoncontextrestoredoncopyoncuechangeoncutondblclickondragondragendondragenterondragleaveondragoverondragstartondropondurationchangeonemptiedonendedonerroronfocusonfocusinonfocusoutonformdataonfullscreenchangeonfullscreenerrorongesturechange {{non-standard_inline}}ongestureend {{non-standard_inline}}ongesturestart {{non-standard_inline}}ongotpointercaptureoninputoninvalidonkeydownonkeypress {{deprecated_inline}}onkeyuponloadonloadeddataonloadedmetadataonloadstartonlostpointercaptureonmousedownonmouseenteronmouseleaveonmousemoveonmouseoutonmouseoveronmouseuponmousewheel {{deprecated_inline}} {{non-standard_inline}}onpasteonpauseonplayonplayingonpointercancelonpointerdownonpointerenteronpointerleaveonpointermoveonpointeroutonpointeroveronpointerrawupdateonpointeruponprogressonratechangeonresetonresizeonscrollonscrollendonscrollsnapchange {{Experimental_Inline}}onscrollsnapchanging {{Experimental_Inline}}onsecuritypolicyviolationonseekedonseekingonselectonselectionchangeonselectstartonslotchangeonstalledonsubmitonsuspendontimeupdateontoggleontouchcancelontouchendontouchmoveontouchstartontransitioncancelontransitionendontransitionrunontransitionstartonvolumechangeonwaitingonwebkitmouseforcechanged {{non-standard_inline}}onwebkitmouseforcedown {{non-standard_inline}}onwebkitmouseforceup {{non-standard_inline}}onwebkitmouseforcewillbegin {{non-standard_inline}}onwheel{{Specifications}}
{{Compat}}