HTML Global Attributes

The attributes common to all HTML elements are called the HTML Global attributes. Both the standard and non-standard elements support these attributes and thus can be used with each element. However, the HTML Global attributes may not have any effect on some elements. All the HTML global attributes are listed below:

ATTRIBUTE
VALUE
USES
accesskey character To specify a shortcut key for an element.
class classname To specify one or multiple class names for an element and is mainly used with the stylesheet.
Contenteditable true

false

To define whether the content within an element is editable or not. It was introduced in HTML5.
contextmenu menu_id To specify the id for the <menu> element to be used as a context menu for an element.
data-* somevalue To store element-specific private data. It was introduced in HTML5.
dir rtl

ltr

auto

To define the direction of the content inside an element.
draggable true

false

auto

To define whether an element is movable or not using Drag and Drop API. It was introduced in HTML5.
dropzone copy

move

link

To specify the action taken (copied, moved, or linked) on the dragged element when it is dropped. It was introduced in HTML5.
hidden To hide an element from view. It was introduced in HTML5.
id id To define a unique id for an element.
lang language_code To define the primary language for the content of an element.
style style To apply inline CSS to an element.
spellcheck true

false

To indicate whether the spelling errors should be checked for in the content or not. It was introduced in HTML5.
tabindex number To define the tabbing order of an element.
title text To provide additional information about an element.
translate yes

no

To define whether an element’s contents should be translated or not. It was introduced in HTML5.