Video tutorialTrack course · freeCodeCamp
Speed
Transcript & captions
5/5
Attributes give extra information about an element. They always live in the start tag and usually come in name="value" pairs.
| Attribute | Used on | Purpose |
|---|---|---|
| href | <a> | Destination URL of a link |
| src | <img>, <script> | Source file to load |
| alt | <img> | Text alternative for screen readers |
| id | any | Unique identifier for one element |
| class | any | Reusable hook for CSS and JS |
| style | any | Inline CSS for that element |
Try it yourself
Knowledge check
0/1 answeredWhich attribute must be unique on a page?