HTML Global Attributes: A Complete Reference Guide
This comprehensive guide lists all HTML global attributes—attributes that can be used on any HTML element—along with their descriptions and usage examples. Master these attributes to build more efficient and semantically rich web pages.
HTML Global Attributes: Attributes for All Elements
Global attributes are special attributes that can be applied to any HTML element. They provide extra information or control how the element behaves.
List of HTML Global Attributes
The table below lists common global attributes and their functions.
Attribute | Description |
---|---|
accesskey |
Specifies a keyboard shortcut to activate or focus the element. |
class |
Specifies one or more class names for the element (used with CSS styles). |
contenteditable |
Specifies whether the element's content can be edited by the user. |
data-* |
Used to store custom data specific to the page or application. |
dir |
Specifies the text direction (e.g., "ltr" for left-to-right, "rtl" for right-to-left). |
draggable |
Specifies whether the element can be dragged (for drag-and-drop functionality). |
enterkeyhint |
Specifies the behavior of the Enter key on a virtual keyboard. |
hidden |
Hides the element from the user. |
id |
Specifies a unique identifier for the element (must be unique within the document). |
inert |
Tells the browser to ignore this element (useful for disabling parts of the page). |
inputmode |
Specifies the type of virtual keyboard to display (e.g., "text", "numeric"). |
lang |
Specifies the language of the element's content. |
popover |
Specifies a popover element (for tooltips or pop-up information). |
spellcheck |
Specifies whether the browser's spell checker should check the element's content. |
style |
Specifies inline CSS styles for the element. |
tabindex |
Specifies the element's position in the tab order. |
title |
Provides extra information about the element, often displayed as a tooltip. |
translate |
Specifies whether the element's content should be translated. |