HTML Attributes
Awesome! Now let’s make your elements more powerful with attributes. Attributes add extra information to elements—like giving your car a color or your phone a ringtone.
What is an Attribute?
Attributes go inside the opening tag and usually come in name="value" pairs.
Example:
<a href="https://example.com">Visit Example</a>
hrefis the attribute namehttps://example.comis the value
Common Attributes
href(for links)src(for images)alt(alternative text for images)idandclass(for styling and scripting)style(inline CSS)
Example:
<img src="cat.jpg" alt="A cute cat" width="200" />
<p id="intro" class="highlight">Welcome!</p>
tip
Always use alt for images—it's good for accessibility!
What's Next?
Let’s build interactive pages! Next: HTML Forms to collect user input.