HTML Global Attributes

HTML Global Attributes are attributes that can be used with almost all HTML elements. Unlike element-specific attributes (like href for <a> or src for <img>) global attributes work across most tags.

They are mainly used for identification, styling, accessibility, behavior control, and storing custom data.

All global attributes are written inside the opening tag and usually follow the format,

attribute="value"

This reference table helps you quickly understand commonly used global attributes and their purpose.

HTML Global Attributes Reference

AttributeDescription
accesskeySpecifies a shortcut key to activate or focus an element
classSpecifies one or more class names for styling
contenteditableSpecifies whether content is editable
data-*Stores custom data private to the page
dirSpecifies text direction (ltr or rtl)
draggableSpecifies whether an element is draggable
hiddenHides the element
idSpecifies a unique identifier
langSpecifies the language of the element
spellcheckEnables or disables spell checking
styleAdds inline CSS styles
tabindexSpecifies the tab order of an element
titleProvides extra information (tooltip)
translateSpecifies whether content should be translated

Leave a Comment