What are HTML Attributes?

HTML attributes provide additional information about an HTML element. They help the browser understand how an element should behave, what extra information it contains, or how it should be displayed. Attributes are always written inside the opening tag of an element and usually follow the format attribute="value".

Think of it like this: an HTML element is the object, and an attribute is the information or settings about that object. For example:

<img src="cat.jpg" alt="Cat">

Enter fullscreen mode