What are HTML Global Attributes?
HTML attributes are a special type of instructions that are given to the HTML elements. The attributes are element dependent and a specific element can have a specific HTML attribute. However, there are certain HTML attributes, which are used as global HTML attributes and can be used with all types of elements. The below table lists all the HTML attributes that are global can be used with all HTML elements.
This guide is a reference to HTML global attributes and lists all the global attributes along with a short description.
|accesskey||This attribute creates a shortcut key to focus on an element.|
|class||This attribute is used to add one or more classes for the element.|
|contenteditable||If this attribute is set to “true” for an element, the content of the element is editable by the user.|
|data-*||The private data for a page or application is stored using this attribute.|
|dir||It declares the direction of the text in an element.|
|draggable||If it is set to “true” for an element, the element is draggable on the screen.|
|hidden||Makes an element irrelevant and hides it.|
|id||The ID for an HTML element is set using this attribute.|
|lang||It defines the language of the document.|
|spellcheck||Whether to check the spellings of the element or not is defined using the spellcheck attribute.|
|style||This global attribute assigns a class to an element.|
|tabindex||The tabbing order of an element is set using tabindex.|
|title||Some extra information is added to the element using the title attribute which pops up upon hover on the element.|
|translate||Tells the browser whether the content of the element is to be translated or not.|