🌐HTML Attribute
Also known as Attribute (HTML), HTML Attributes
Extra facts put in a tag, as a name and a value.
Think of it like
Think of it like a sticker on a box. It adds one more fact, like where to send it.
Example
Jack's photo did not show up. He had typed scr instead of src, so the image had no address.
Why it matters
Links, images and forms do nothing without the right attributes. Labels like class let CSS style the right parts.
Definition
Example code
html
<img src="cat.jpg" alt="A ginger cat asleep">Common mistake
Key takeaways
- 1Name and value. Written as name="value" in the tag.
- 2Some are needed. A link needs href, an image needs src.
- 3Some are labels. class and id help code find it.