HTML Global Attributes

HTML Global Attributes are attributes that can be used with any HTML element. They include id, class, style, title, lang, tabindex, and others, providing common functionality and enhancing element behavior and presentation across web pages.

List of Global Attributes:

Global Attributes

Description

Example

accesskey It is the keyboard shortcuts to activate/focus specific elements.
Try

autocapitalize It is used to capitalize the text entered/edited by the user automatically.
Try

autofocus The autofocus attribute in HTML is used to specify that the element should get focus when the page loads. It is a boolean attribute.
Try

class It specifies one or more class names for an HTML element.
Try

contenteditable It is used to specify whether the content present in the element is editable or not. When this attribute is not set in an element, this element will inherit from its parent element.
Try

contextmenu It is the id of a <menu> that provide contextmenu for this element.
Try

data-* It can be used to define our own custom data attributes.
Try

dir It is used to specify the text direction of the element content.
Try

draggable It is used to specify whether an element is draggable or not. Links and images are by default draggable.
Try

enterkeyhint It provides a hint on what label or icon to present on a virtual keyword while pressing keys.
Try

hidden It is used to define the visibility of elements. It contains a boolean value. If this attribute is used then browsers will not display elements that have the hidden attribute specified.
Try

id It is a unique identifier that is used to specify the document and used by CSS and JavaScript to perform a certain task for a unique element.
Try

inputmode It is used mainly to provide a hint to browsers on which virtual keyboard configuration to use when editing this element or its contents.
Try

is It specifies that standard HTML behaves as a registered custom built-in element.
Try

itemid It is a global identifier of an item that is unique.
Try

itemprop It adds properties to an item.
Try

itemscope It works with item types to ensure that the HTML contained in a block is about a particular item.
Try

itemtype It specifies the URL vocabulary which is used to define itemprops.
Try

lang It is used to specify the language of the element content. Some examples of languages are en for English, es for Spanish, etc.
Try

nonce It is a cryptographic nonce (“number used once”)  used by a content security policy to check given fetch allowed to proceed or not.
part It is a space-separated list of the part names of the element.
Try

slot It is used to assign a slot in a shadow DOM shadow tree to an element.
Try

spellcheck The Spell Check feature in HTML is used to detect grammatical or spelling mistakes in the text fields.
Try

style Style in HTML are basically rules that describe how a document will be presented in a browser.
Try

tabindex It is used to specify the tab order of an element. It is used when the tab button is used for navigating.
Try

title It is used to define the title of an HTML document, sets the title in the browser toolbar, and provides the title for the web page when it is added to favorites.
Try

translate The translate attribute in HTML is used to specify whether the content of an element is translated or not.
Try



Contact Us