Global attributes

HTML global attributes can be used on many or all HTML elements. They add information such as an identifier, language, relationship, or interaction state without belonging to only one element type.

What you will learn

Common examples

<p id="intro" class="lead" lang="en" title="A short introduction">
  Welcome to this page.
</p>

Global does not mean “always appropriate”

An attribute may be allowed globally but still be a poor choice in a particular context. Use a meaningful value, avoid duplicate IDs, and do not put sensitive information in attributes that visitors can inspect.

Global and element-specific attributes

A global attribute can appear on many elements, while an attribute such as href belongs to links or src belongs to resources such as images and scripts. Check the element's documentation before adding an attribute.

Related pages