HTML5 Global Attributes
Each HTML5 element supports a number of attributes. The attributes listed here are common to all HTML5 elements.
Attribute | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accesskey | Specifies a shortcut key that can be used to access the element.
Possible values. [Any string of characters. This string of characters specifies the key/s the user needs to use in order to access the element.] |
||||||||||||
class | Document wide identifier. Used to refer to a class specified in the style sheet. The value should be the name of the class you wish to use.
For more information, see CSS class. |
||||||||||||
contenteditable | Sets whether the user can edit the content or not.
Possible values:
|
||||||||||||
contextmenu | Sets a context menu for an element. The value must be the ID of a menu element in the DOM | ||||||||||||
dir | Specifies the direction of the text.
Possible values:
|
||||||||||||
draggable | Specifies whether the user is allowed to drag the element or not.
Possible values:
|
||||||||||||
dropzone | Specifies what should happen when the user "drops" an element (i.e. after dragging it) onto the current element.
Must be an unordered set of unique space-separated tokens that are ASCII case-insensitive. Possible values:
Note that this attribute must not have more than one of the three feedback values (copy, move, and link) specified. If none are specified, the copy value is implied. |
||||||||||||
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.
This is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either Possible values:
|
||||||||||||
id | Document wide identifier. Used with CSS and JavaScript. The value should be the name of the id you wish to use.
For more information, see CSS id. |
||||||||||||
inert | Boolean attribute that indicates that the element is to be made inert. This means that the browser/user agent acts as though the element is not there, even though it may still display the element.
For example, a block of text that has been marked with the This is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either Possible values:
|
||||||||||||
itemid | Provides a global identifier for an "item". The itemid attribute is optional, however if it is provided, it must have a value that is a valid URL potentially surrounded by spaces.
The |
||||||||||||
itemprop | Provides one or more properties to one or more "items".
Although the
Also, |
||||||||||||
itemref | Used in conjunction with the itemscope attribute, the itemref attribute provides a list of additional elements to crawl to find the name-value pairs of the "item". Although the itemref attribute is optional, if specified, it must have a value that is an unordered set of unique space-separated tokens that are case-sensitive, consisting of IDs of elements in the same home subtree. Also, the itemref can only be used on elements that also have the itemscope attribute present.
|
||||||||||||
itemscope | HTML5 elements that have the itemscope attribute create a name-value pair called an "item". Elements with an itemscope attribute may also have an itemtype attribute specified, to give the item types of the item.
This is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either Possible values:
|
||||||||||||
itemtype | Provides an item type for elements containing the itemscope attribute. The itemtype attribute is optional however, if it is specified, it must have a value that is an unordered set of unique space-separated tokens that are case-sensitive, each of which is a valid URL that is an absolute URL, and all of which are defined to use the same vocabulary. The attribute's value must have at least one token.
The |
||||||||||||
lang | Sets the language code to be used.
Possible values: [Must be a valid RFC 3066 language code, or an empty string.] |
||||||||||||
spellcheck | Specifies whether the element should have its spelling checked.
If this attribute is missing, the element will use the default behavior, possibly based on the parent's own |
||||||||||||
style | Specifies inline styles for the element. The value should be the style definition you wish to use.
For more information, see inline style sheets. |
||||||||||||
tabindex | Helps determine the tabbing order (when the user 'tabs' through the elements on the page).
Possible values: [Any valid integer. For example, 0, 1, 2, 3, ...etc] |
||||||||||||
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").
Possible values: [Any text to be displayed as a "tool tip".] |
||||||||||||
translate | Specifies whether the element's attribute values and the values of its Text node children are to be translated when the page is localized, or whether to leave them unchanged.
The
If the |
Most HTML Elements
The following event handler attributes are supported by all HTML elements, as both content attributes and DOM attributes, and on Window objects, as DOM attributes: