HTML Global Attributes
HTML global attributes are attributes that can be used on virtually any HTML element, regardless of its specific type or purpose. These attributes provide essential functionality and behaviors for web page elements.
HTML global attributes provide a flexible and consistent way to enhance the functionality and behavior of HTML elements, making it easier to create interactive and accessible web pages. These attributes are not tied to any specific HTML element and can be used across various elements, giving web developers a wide range of options for customization and interactivity.
Attribute | Definition |
---|---|
accesskey | Specifies a shortcut key that can be used to access the element. |
class | Used to refer to a class specified in the style sheet. The value should be the name of the class you wish to use. |
contenteditable | Sets whether the user can edit the content or not. |
contextmenu | Specifies a context menu for an element. The context menu appears when a user right-clicks on the element. --obsolete attribute-- |
data-* | Used to store custom data private to the page or application. |
dir | Specifies the text direction for the content in an element. Possible Values:
|
draggable | Specifies whether the user is allowed to drag the element or not. Possible Values:
|
hidden | Indicates that the element is not yet, or is no longer, relevant. The browser/user agent does not display elements that have the hidden attribute present. |
id | Specifies a unique id for an element. |
inert | Specifies that the browser should ignore this section. |
lang | Specifies the language of the elements content. |
spellcheck | Specifies whether the element should have its spelling checked. |
style | Specifies inline styles for the element. The value should be the style definition you wish to use. |
tabindex | Helps determine the tabbing order (when the user 'tabs' through the elements on the page). |
title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
translate | Specifies whether the content of an element should be be translated or not. |