HTML Global Attributes Reference

All global HTML attributes with type, inherited flag and browser support.

A searchable HTML global attribute reference covering id, class, style, data-*, ARIA, tabindex, contenteditable, inert, popover and more, with accepted values and browser support.

What is a global attribute?

A global attribute may be applied to any HTML element, unlike element-specific attributes such as href on a or src on img. Examples include id, class, style, title, lang, dir, hidden, tabindex and the data-* and aria-* families.

This is a searchable reference for HTML global attributes — the attributes you may place on any element regardless of its tag. It spans identity (id, class), presentation (style), internationalization (lang, dir), behaviour (hidden, tabindex, contenteditable, inert, popover), the custom data-* family, and the accessibility attributes (role, aria-*).

How it works

Global attributes are part of the content model of every element, so the browser understands them everywhere. They take different value shapes: some are boolean (present or absent, like hidden and autofocus), some take an enumerated token (dir="ltr", contenteditable="true"), some take an integer (tabindex), and the data-* and aria-* prefixes accept a family of names. Custom data attributes are surfaced to JavaScript through the dataset property, where dashes become camelCase (data-user-id becomes dataset.userId). The accessibility attributes layer ARIA semantics on top of native HTML: role overrides the implicit role, while aria-* attributes expose state and properties such as aria-expanded or aria-label.

Tips and notes

Prefer native semantics over ARIA — the first rule of ARIA is not to use it when a native element already does the job. Use tabindex="0" to make a custom interactive widget focusable, and tabindex="-1" to allow programmatic focus without inserting it into the tab order; avoid positive values. The newer inert, popover, enterkeyhint and inputmode attributes improve interaction and on-screen keyboards. Custom data attributes should hold private page state, not data better expressed with a real attribute or microdata.

Example

<button
  type="button"
  data-product-id="42"
  aria-expanded="false"
  tabindex="0">
  Details
</button>

Everything runs in your browser; nothing you search is uploaded.