3 of 1 ·Images & buttons

Lesson 3 · Web Explorer
Adding media and interactive elements.
HTML Foundations
HTML labels the parts of a page. A heading can be written as <h1>Hello</h1>. Start with a working page and change the heading; then add one paragraph.
Click to zoomSome tags don't wrap anythingMost tags surround content. Images don't — there's nothing to put between an opening and closing tag, because the picture is the content.
So <img> is a self-closing tag. It stands alone and carries everything it needs as attributes:
<img src="photo.jpg" alt="Me at the beach">
src is where the picture lives — a filename or a web addressalt is a text description for when the image can't be seen
Click to zoomalt text is not optionalIt's tempting to skip alt since nothing visibly breaks. Don't.
That text is read aloud to blind users by screen readers. It appears if the image fails to load. Search engines use it to understand your page.
Describe what the image shows, not that it's an image:
alt="My dog sleeping on a red sofa"alt="image" or alt="photo1.jpg"A page full of images with no alt text is, to someone using a screen reader, a page full of silence.
8 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.