HTML Global Attributes
Global attributes can be added to any HTML element. Here are all 33, each linking to its accepted values, description and live, editable examples.
| Name | Description |
|---|---|
| accesskey | Specifies the shortcut key to focus elements in the document. |
| autocapitalize | Controls how on-screen keyboards automatically capitalize text the user enters. |
| autocorrect | Controls whether the browser automatically corrects spelling and punctuation as the user types. |
| autofocus | Automatically moves keyboard focus to the element when the page loads. |
| class | Specifies multiple classnames for an element, often used for styling the element with CSS. |
| contenteditable | Specifies whether the element is editable or not. |
| data | Specifies custom data for an element, you can use multiple data attributes. |
| dir | Specifies the text direction of the elements content. |
| draggable | Specifies whether the element is draggable or not. |
| enterkeyhint | Hints which action label the virtual keyboard should show on its Enter key. |
| exportparts | Forwards the shadow parts of a nested component up through the shadow boundary. |
| hidden | Specifies whether the element is hidden or visible. |
| id | Specifies the unique id for an element, all id's should be unique and not to be reused for multiple elements. |
| inert | Makes an element and its subtree inert: non-interactive, unfocusable, and ignored by assistive tech. |
| inputmode | Hints the type of virtual keyboard to display for an editable field. |
| is | Lets a standard element behave as a registered customized built-in element. |
| itemid | Specifies the unique item id. |
| itemprop | Specifies the property for an item. |
| itemref | Specifies the list of element id's with additional properties. |
| itemscope | Specifies whether an element should be a new item or not. |
| itemtype | Specifies the vocabulary to which the item relates to. |
| lang | Specifies the language of the element. |
| nonce | A single-use cryptographic token a Content-Security-Policy uses to allow a specific inline script or style. |
| part | Exposes an element inside a shadow tree so it can be styled from outside with ::part(). |
| popover | Turns an element into a popover shown in the top layer, with built-in light-dismiss. |
| slot | Assigns an element to a named slot in a web component's shadow DOM. |
| spellcheck | Specifies if the elements value should have its spelling and grammar checked. |
| style | Specifies the inline style for the element. |
| tabindex | Specifies the position of the navigation tabbing in the document. |
| title | Specifies a title for the element. |
| translate | Specifies whether the element should be translated or not. |
| virtualkeyboardpolicy | Controls whether the on-screen keyboard appears automatically for a contenteditable element. |
| writingsuggestions | Controls whether the browser shows inline writing suggestions in editable fields. |