Global
HTML global attributes are attributes that can be used with any HTML element, no matter the element's type. These attributes enhance the functionality of elements, contributing to better accessibility, styling, interactivity, and overall user experience.
HTML Global Attributes
Global attributes
can be used with all HTML elements.
Attribute | Description |
---|---|
accesskey | Defines a shortcut key to activate or focus on an element. |
class | Assigns one or more class names to an element, linking it to a stylesheet. |
contenteditable | Determines if an element's content can be edited. |
data-* | Stores custom data specific to the page or application. |
dir | Defines the text direction within an element. |
draggable | Indicates whether an element can be dragged. |
enterkeyhint | Sets the label for the enter key on a virtual keyboard. |
hidden | Specifies that an element is currently not relevant or visible. |
id | Assigns a unique identifier to an element. |
inert | Indicates that an element should be ignored by user interaction. |
inputmode | Defines the expected input type for a virtual keyboard. |
lang | Specifies the language of the element's content. |
popover | Defines an element as a popover. |
spellcheck | Determines whether spelling and grammar checking should be enabled. |
style | Applies inline CSS styles to an element. |
tabindex | Sets the tabbing order for navigating elements. |
title | Provides additional information about an element. |
translate | Specifies whether an element’s content should be translated. |
Attributes
HTML attributes define an element’s behavior and appearance, using a key-value structure (e.g., attribute="value"). They enhance customization, making web pages more interactive and accessible.
accesskey
The accesskey attribute in HTML designates a shortcut key that activates or focuses on an element, enhancing accessibility and navigation. It is included within the element's tag.