Camp 2 · Schritt 7 von 14
Images and alt text
Embed images with <img> — and write the alt text that makes them work for everyone.
Images turn walls of text into pages people actually want to read. The
<img> element embeds them — and comes with one responsibility.
The img element
src— where the image file lives (likehref, but for embedded content)alt— text describing the imagewidth/height— dimensions in pixels (helps pages load without jumping)
<img> is self-closing — it has no content between tags, because the image
is the content.
alt text: the non-negotiable part
The alt attribute is what appears — and what's read aloud — when the
image can't be seen:
- Blind and low-vision visitors hear it via screen readers
- Broken image? The alt text shows instead
- Search engines read it to understand the image
Write what the image communicates, not "image of":
alt="image" ❌ says nothing
alt="photo123.jpg" ❌ worse
alt="Hiker celebrating on a foggy summit" ✅ paints the picture
alt="" ✅ for purely decorative imagesThat last one matters: an empty alt="" tells screen readers "skip
this, it's decoration" — which is kinder than describing every swoosh and
divider.
A product photo of red hiking boots needs alt text. Best choice?
A decorative wavy divider line separates two sections. Its alt should be: