Glossary · Beginner

HTML attribute

An HTML attribute adds a name-value setting or state to an element, such as a link destination or document language.

Editorial preview — publication review is still required.

Author
Editorial team
Reviewer
Publication review pending
Review tier
annual

Definition

An attribute appears in an element’s start tag and supplies configuration, state, or a relationship. The href attribute of a link supplies its destination; the lang attribute supplies a language.

Syntax

<a href="/about">About this site</a>

Attribute values are data, not visual decoration. Use only attributes permitted for the element and purpose.