An HTML attribute is extra information written inside an element's opening tag as a name and usually a value, like class="nav" or src="photo.jpg". Attributes configure behavior, identity and accessibility of the element.
Why it matters
Attributes drive much of the web: href creates links, src loads resources, alt describes images for screen readers and id and class connect elements to CSS and JavaScript. Some are boolean, such as disabled, and are active by their mere presence. Wrong or missing attributes cause broken links, failed loads and accessibility gaps.
Example
<img src="/img/logo.png" alt="SiteDownCheck logo" width="120" height="40">
<input type="email" name="email" required>
The image has four attributes. The input uses required, a boolean attribute with no value.
Common mistakes
- Writing
disabled="false". Any presence of a boolean attribute turns it on. - Leaving out
alton meaningful images. - Using the same
idon more than one element in a page.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.