12 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| Attribute - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/Attribute | reference | web, html, css, javascript, documentation | 2026-05-05T05:24:35.238959+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
Attribute
An attribute extends an HTML or XML 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 an equals sign or a value. That is a shorthand for providing the empty string in HTML. However, this is not valid in XML: XML requires all attributes to have an explicit value.
A number of HTML attributes are boolean attributes. These attributes' values are only controlled by the presence or absence of the attribute. See boolean attributes for more information.
In this article
Reflection of an attribute
Attributes may be reflected into a particular property of the specific interface.
This means that the value of the attribute can be read or written directly in JavaScript through a property on the corresponding interface, and vice versa. The reflected properties offer a more natural programming approach than getting and setting attributes using the getAttribute() and setAttribute() methods of the Element interface.
For more information see Attribute reflection.
See also
- HTML attribute reference
- Attribute reflection
- Information about HTML's global attributes
- XML StartTag Attribute Recommendation in W3C XML Recommendation
- Related glossary terms: