Global HTML Attributes

649pages on
this wiki
Add New Page
Comments0 Share

The attributes listed below are standard, and are supported by most HTML and XHTML tags. There were some exceptions as late as HTML 4.01 and XHTML 1.1, but HTML5 says they are all supported but not necessarily useful. An attribute is an extension to an element, and is used to include more choices towards the overall functionality. Many can be combined together but most of them only work in specific elements.

Core attributes

Attribute Value Description
class classname Specifies a classname for an element
id id Specifies a unique id for an element
style style_definition Specifies an inline style for an element
title text Specifies extra information about an element

Language Attributes

Useless in <base />, <br />, <frame />, <frameset>, <hr />, <iframe>, <param />, and <script> elements.

Attribute Value Description
dir ltr
Specifies the text direction for the content in an element
lang language_code Specifies a language code for the content in an element. Language code reference.
xml:lang language_code Specifies a language code for the content in an element, in XHTML documents. Language code reference. Has no meaning in HTML5.

Keyboard Attributes

Attribute Value Description
accesskey character Specifies a keyboard shortcut to access an element
tabindex number Specifies the tab order of an element

Mouse Attributes

Attribute Value Description
contextmenu boolean TBA
draggable boolean Determines whether the element is draggable.
dropzone boolean TBA

Content Attributes

Attribute Value Description
contenteditable boolean TBA
hidden boolean TBA
spellcheck boolean TBA

Data Attributes

These attributes store data to the page and/or application.

Attribute Value Description
Custom Data Attributes
data-* value This attribute stores custom data private to the page or application.
Microdata Attributes
itemscope boolean TBA
itemtype URL TBA
itemid value TBA
itemprop value TBA
itemref value TBA

Inline event handlers

Refer to Global Event Attributes for inline event handlers
Every type of event has a corresponding attribute which can set the event-handler of an element for that event type. The attribute's name is "on" followed by the name of the event - for example, "onclick" for click events. However, per Separation of Layers these attributes should not be used except in special cases. See the article on Events for the encouraged solution. Here is a list of event attributes:

See Also

Standard HTML5 Attributes

External links

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.