CHOOSE ANY STEP
FREECODECAMP / HTML / STEP 9 OF 42
freeCodeCamp: Build a Cat Photo App, Step 9
Give the image a text alternative
Written guidance is free. Step videos are a member benefit.
Add the alternative text attribute listed in the task below, an equals sign, and quotation marks. Between the quotes, add the exact description: A cute orange cat lying on its back. Keep the source attribute and the rest of your page unchanged.
ORIGINAL WALKTHROUGH ·
Watch with Rob.
Watch the explanation, then apply the change and run the official checks on freeCodeCamp.
You are signed in, but video access needs attention. Check your account access. Your saved work is kept.
Video walkthroughs are included with an active Code Zone membership. The written lesson and practice are free.
Your goals for this step
- Apply the requirements for “Give the image a text alternative” while keeping the earlier page structure.
- Explain img and the role it plays in this change.
- Explain src and the role it plays in this change.
- Compare the expected preview with your work before running the official checks.
THE TASK
What step 9 asks you to do
- Your code should have an
imgelement. You removed theimgelement from an earlier step. - Your
imgelement does not have analtattribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names. - Your
imgelement'saltattribute value is set to something other thanA cute orange cat lying on its back. Make sure thealtattribute's value is surrounded with quotation marks.
Based on the official freeCodeCamp step 9 instructions (opens in a new tab).
Why this works
A picture can carry meaning that isn't available to every visitor. In step nine, we'll give this image a text alternative. Keep the source address, and add an alt attribute inside the same image tag.
What you should see in the preview
The picture still looks the same. Alt text is an alternative, rather than a visible caption. It helps someone using a screen reader understand the image, and can appear if the picture fails to load.
Illustrative browser result. External embeds, navigation and form submission are disabled here. Open freeCodeCamp to test the real behavior. Drag the lower-right corner to make this preview taller.
Terms to know
- img: Image element
- Displays an image from its src. It is a void element, so it does not have a closing tag.
- src: Source attribute
- Points an image, audio player, video player or embedded frame to its resource. Use the exact URL required by the task.
- alt: Alternative text
- Describes an image when it cannot be seen, including for people using screen readers. It is not a visible caption.
If your check does not pass
- Your code should have an
imgelement. You removed theimgelement from an earlier step. - Your
imgelement does not have analtattribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names. - Your
imgelement'saltattribute value is set to something other thanA cute orange cat lying on its back. Make sure thealtattribute's value is surrounded with quotation marks.
Use the preview to inspect the structure, then run the checks on freeCodeCamp. Watching here does not submit code or mark an official step complete.
Know where to find it
You do not have to memorize every element or CSS property. Keep useful references nearby:
- W3Schools: images (opens in a new tab)
Compare the syntax and a focused example.
- W3Schools: attributes (opens in a new tab)
Compare the syntax and a focused example.
- MDN: HTML element reference (opens in a new tab)
Look up the definition, syntax and supported behavior.
What you have accomplished
The change for “Give the image a text alternative” is ready to try. Return to freeCodeCamp, compare your result with the requirements, and run its checks. Your official progress stays there.
Independent guidance from The Code Zone, not affiliated with or endorsed by freeCodeCamp. Complete official work and certification requirements on freeCodeCamp. Curriculum checked November 15, 2026. Curriculum source (opens in a new tab).