Global HTML Attributes
Global attributes are attributes that can be used with HTML elements regardless of the element's specific purpose. They provide common features for identifying elements, applying CSS, specifying language and text direction, controlling keyboard interaction, storing custom data, improving accessibility, and enabling other browser features.
Although global attributes are permitted on HTML elements, an attribute may have no practical effect on an element when the feature it controls does not apply to that element. Select an attribute below to open its complete reference page.
Core Attributes
These commonly used global attributes identify elements, apply styling, provide advisory information, or control whether content is displayed.
classAssigns one or more class names to an element for CSS, scripting, or other processing.hiddenIndicates that an element is not currently relevant and should not normally be displayed.idProvides a unique identifier for an element within the document.styleApplies inline CSS declarations directly to an element.titleProvides advisory information about an element.Language & Text
These attributes describe the language and direction of text or control how textual content may be processed.
autocapitalizeControls automatic capitalization when the user enters text.autocorrectControls whether entered text may be automatically corrected.dirSpecifies the direction of an element's text.langSpecifies the language of an element's content.spellcheckIndicates whether spelling and grammar checking should be enabled.translateIndicates whether translatable content within an element should be translated.writingsuggestionsControls whether browser-provided writing suggestions are enabled.Editing & Input
These attributes affect editable content, text entry, and virtual keyboard behavior.
contenteditableIndicates whether the user can edit an element's content.enterkeyhintProvides a hint for the action displayed on a virtual keyboard's Enter key.inputmodeHints which type of input interface should be presented for text entry.virtualkeyboardpolicyControls virtual keyboard behavior for editable content where supported.Interaction & Focus
These attributes control keyboard access, focus, dragging, and whether page content can be interacted with.
accesskeyProvides a keyboard shortcut for activating or focusing an element.autofocusRequests that an element receive focus automatically.draggableIndicates whether an element can be dragged using the browser's drag-and-drop system.inertMakes an element and its descendants non-interactive and prevents them from receiving focus.tabindexControls whether and how an element participates in keyboard focus navigation.Custom Data & Metadata
These attributes provide custom data, machine-readable metadata, security information, or element behavior used by applications and scripts.
data-*Stores custom data associated with an HTML element.itemidProvides a global identifier for a microdata item.itempropDefines a property associated with a microdata item.itemrefReferences additional elements containing properties of a microdata item.itemscopeCreates a microdata item and defines the scope of its properties.itemtypeSpecifies the vocabulary type associated with a microdata item.nonceProvides a cryptographic nonce that can be used with Content Security Policy.Popover
The global popover attribute identifies an element as popover content that can be displayed above other page content.
popoverDesignates an element as popover content and controls its popover behavior.Web Components & Shadow DOM
These global attributes are used with custom elements, slots, CSS shadow parts, and other Web Components features.
exportpartsExports selected CSS shadow parts so they can be styled outside a shadow tree.isIdentifies a customized built-in element.partAssigns names that allow parts of a shadow tree to be styled with CSS.slotAssigns an element to a named slot within a shadow tree.Accessibility Attributes
ARIA attributes and the role attribute can provide accessibility information when native HTML semantics do not provide the required meaning or behavior. Native HTML elements and semantics should be used whenever they are appropriate.
