HTML chapters

Chapter 5 of 17

Text, links and images

Try this in our HTML Compiler →

The idea

HTML marks up several kinds of content rather than defining numeric and boolean variable types. Text belongs in paragraphs or headings, links use a with an href, and images use img with a src and meaningful alt text. Decorative images use an empty alt attribute instead of an invented description.

Worked example

<p>Open the <a href="https://developer.mozilla.org/">web documentation</a>.</p>
<p>A link can be part of a complete sentence.</p>

What to check

The link text tells a reader what the destination is. Image loading is separate from document parsing; a missing file should not remove the surrounding explanation.

Practice task

Add a link with descriptive text instead of click here. For an image you own, write alt text describing its relevant content.

Check your understanding

Explain the result in your own words before changing the example. Change one thing at a time, compare the result with your prediction, and keep the version that demonstrates the concept clearly.

Try it yourself

Output
Ctrl/Cmd+Enter runs · Ctrl/Cmd+S downloads the project · Local auto-save is always on