HTML Attributes
Attributes add information or settings to HTML elements.
Attributes go in the opening tag
An attribute is usually written as a name, an equals sign, and a quoted value. An element can have more than one attribute.
<a href="https://www.example.com" title="Visit Example">
Visit the website
</a>
<img src="cat.jpg" alt="A gray cat" width="300">
<p class="intro" id="welcome">Hello!</p>
Common attributes
hrefgives a link its destination.srcgives an image its file location;altdescribes the image.classlets CSS style a group of elements;ididentifies one element on the page.titleprovides additional advisory information, often shown as a tooltip.- Some attributes are boolean: their presence means “on,” such as
disabledon a button.