HTML Global Attributes are attributes that can be used with almost all HTML elements. Unlike element-specific attributes (like href for <a> or src for <img>) global attributes work across most tags.
They are mainly used for identification, styling, accessibility, behavior control, and storing custom data.
All global attributes are written inside the opening tag and usually follow the format,
attribute="value"
This reference table helps you quickly understand commonly used global attributes and their purpose.
HTML Global Attributes Reference
| Attribute | Description |
|---|---|
accesskey | Specifies a shortcut key to activate or focus an element |
class | Specifies one or more class names for styling |
contenteditable | Specifies whether content is editable |
data-* | Stores custom data private to the page |
dir | Specifies text direction (ltr or rtl) |
draggable | Specifies whether an element is draggable |
hidden | Hides the element |
id | Specifies a unique identifier |
lang | Specifies the language of the element |
spellcheck | Enables or disables spell checking |
style | Adds inline CSS styles |
tabindex | Specifies the tab order of an element |
title | Provides extra information (tooltip) |
translate | Specifies whether content should be translated |