Module global

Module global 

Source
Expand description

Attribute names for global HTML attributes.

§Purpose

Global attributes can be used on any HTML element, providing common functionality like styling, identification, accessibility, and interaction control across all elements.

§Common Attributes

  • class: Space-separated CSS class names for styling
  • id: Unique identifier for the element
  • style: Inline CSS styles
  • title: Advisory information (tooltip text)
  • lang: Language of the element’s content
  • dir: Text directionality (ltr, rtl, auto)
  • tabindex: Tab order for keyboard navigation
  • hidden: Hides element from rendering
  • contenteditable: Makes element content editable
  • draggable: Enables drag-and-drop
  • role: ARIA role for accessibility

§Example

<div class="container" id="main" lang="en" dir="ltr">
  <p class="text" title="Helpful tooltip" tabindex="0">Content</p>
  <span role="button" draggable="true">Drag me</span>
</div>

§WHATWG Specification

Constants§

ACCESSKEY
The accesskey attribute.
CLASS
The class attribute.
CONTENTEDITABLE
The contenteditable attribute.
DIR
The dir attribute.
DRAGGABLE
The draggable attribute.
HIDDEN
The hidden attribute.
ID
The id attribute.
LANG
The lang attribute.
ROLE
The role attribute.
SLOT
The slot attribute.
SPELLCHECK
The spellcheck attribute.
STYLE
The style attribute.
TABINDEX
The tabindex attribute.
TITLE
The title attribute.
TRANSLATE
The translate attribute.