docs.rodeo

MDN Web Docs mirror

Global attributes

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:

List of global attributes

[!NOTE] The item* attributes are part of the WHATWG HTML Microdata feature.

List of global event handler attributes

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.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN