Global attributes are attributes that can be used on all HTML elements. They define an element's identity, style, language, and interaction behavior.
Core Identity Attributes
Global Attributes
Description
id
A unique identifier for the element, used by CSS selectors, JavaScript and anchor links.
class
A space-separated list of class names used by CSS or JavaScript selectors.
style
Inline CSS styles applied directly to the element, with higher priority than external stylesheets.
title
Tooltip text shown on hover.
Language & Direction
Global Attributes
Description
lang
Declares the language of the element's content.
dir
Text direction: ltr (default) or rtl.
Interaction & Accessibility
Global Attributes
Description
contenteditable
Specifies whether the element's content is editable.
draggable
Specifies whether the element is draggable.
hidden
Hides the element from rendering.
tabindex
Specifies the element's tab order.
accesskey
Assigns a keyboard shortcut to focus/activate the element.
spellcheck
Specifies whether the element's content is spell-checked.
translate
Specifies whether the element's content should be translated.
inert
Makes the element and its subtree non-interactive.
Data & Others
Global Attributes
Description
data-*
Custom data attributes for storing private page/app data.
autofocus
Automatically focuses the element on page load.
autocapitalize
Controls auto-capitalization on mobile keyboards.
enterkeyhint
Hints the label for the virtual keyboard's Enter key.
inputmode
Hints the type of virtual keyboard to display.
nonce
A cryptographic nonce used by Content Security Policy.
slot
Assigns the element to a slot in a shadow DOM.
part
Names the element's parts for styling via CSS ::part().
popover
Specifies the element's popover behavior.
is
Specifies the name of a customized built-in element.
Web-Tutorial Tech Team
A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.