What is an attribute in HTML?
An attribute gives extra information about an HTML element. It is written inside the opening tag as name="value".
<a href="https://example.com" target="_blank">Visit</a>
<img src="photo.jpg" alt="A photo" width="200">
Here href, target, src, alt and width are attributes. Some common ones are id, class, style and title. Boolean attributes like disabled and required have no value. See HTML Attributes.
Learn more about the similar topics:
| Tutorials |
|---|
| List of common HTML Tags |
| HTML Elements and Tags |
| HTML Attributes |
| HTML Block and Inline Elements |
| HTML Div and Span |
| HTML Class and ID |
| Exercises & Assignments |
|---|
| No Content Found. |