An attribute extends an element, changing its behavior or providing metadata.
An attribute always has the form name="value"
(the attribute's identifier followed by its associated value).
You may see attributes without the equals sign or a value. That is a shorthand for providing the empty string in HTML, or the attributeโs name in XML.
<input required> <!-- is the same asโฆ --> <input required=""> <!-- or --> <input required="required">
Learn more
Technical reference
- HTML attribute reference
- Information about HTML's global attributes