totn HTML

HTML: Global Attributes

Global Attributes are attributes that are common to all HTML elements.

Global Attributes

The following is a list of global attributes that apply to all HTML elements:

Attribute Description HTML Compatibility
accesskey Hint for generating a keyboard shortcut key for the element HTML 4.01, HTML5
class List of classes for the element (separated by spaces). A class can appear more than once in the document. Unlike an id, which can only appear once in a document. HTML 4.01, HTML5
contenteditable Enumerated attribute Indicating whether the element should be editable by the user. true or empty string indicates it is editable, false indicates it is not editable.
If this attribute is omitted, its default value is inherited from its parent element.
HTML5
contextmenu Menu that appears based on user interaction HTML5
data-* Custom data attributes that allow proprietary information to be exchanged between the HTML and the DOM HTML5
dir Enumerated attribute indicating the direction of the element's text. It can be one of the following values: ltr, rtl, auto.

ltr - means left to right
rtl - means right to left
auto - means that the user agent will determine the direction.
HTML 4.01, HTML5
draggable

Enumerated attribute indicating whether the element can be dragged. It can be one of the following values: true, false

HTML 4.01, HTML5
dropzone Enumerated attribute indicating what type of content can be dropped on the element HTML5
hidden Boolean attribute indicating whether the element is relevant HTML5
id Defines a unique identifier (id) for an element. This means that the id can only appear once in the document, which is different than a class (a class can appear multiple times in a document). HTML 4.01, HTML5
lang Defines the language of the element HTML 4.01, HTML5
spellcheck Enumerated attribute indicating whether the element may be spell checked. It can be one of the following values: true, false HTML5
style Contains CSS styling declarations to apply to the element. Try to use CSS files instead. HTML 4.01, HTML5
tabindex Integer attribute indicating whether the element can get the "focus". It can be one of the following values: negative value, 0, positive value.

negative value - means the element can get the "focus" but not reachable through sequential keyboard navigation

0 - means that the element can get the "focus" through sequential keyboard navigation (order is determined by platform convention)

positive value - means that the element can get the "focus" through sequential keyboard navigation (order is determined by sequential order of tabindex)
HTML 4.01, HTML5
title Additional text describing the element HTML 4.01, HTML5