Links, Images and Media
- 6 min reading
- 6 min activity
0 of 4 tasks doneup to 85 XP
Mission 2 starts: Open your doors. Your page opens to the world. Today: links, pictures and media.
- Link to a website, to a part of the same page, to a file and to an email address.
- Add a picture with useful alt text, a size and a caption.
- Add video, audio and another page with controls and a title.
In Unit 1 you wrote <html lang="en">. lang="en" is an attribute: extra information in the opening tag, written as name="value".
Quick check: where does an attribute go?
Inside the opening tag, after the tag name and a space: <a href="...">. Never in the closing tag.
Links: the doors of your page
A link is an <a> tag. Its attribute href ("hypertext reference") holds the address. The link text is what people see and tap.
<a href="https://example.com">Visit the example site</a>
| The link... | Example |
|---|---|
| opens a website | href="https://example.com" |
jumps to the element with id="contact" | href="#contact" |
| opens a new tab | target="_blank" |
| saves a file | href="/cv.pdf" download |
| starts an email | href="mailto:name@example.com" |
- Read my CV
- Email me
- Bus times (opens in a new tab)
- click here
- here
Screen reader users often jump from link to link, so each link text must make sense alone. New tabs can confuse people: use them rarely, and say so in the link text.
What kind of link?
Pictures with <img>
This example is from the course slides. <img> has no closing tag.
<img src="mountains.jpg" alt="Mountains at sunset"
width="600" height="400">
The picture file. Required.
Words that replace the picture: screen readers read them, and browsers show them when the picture cannot load.
The size in pixels. The browser keeps the space, so the text does not jump.
The slides also show title, a text that appears under a mouse. Phones and keyboards cannot show it, so important words go in the page or in alt.
- Look
What does the picture show? Mountains, an orange sky.
- Ask
What does a listener need here? The place and the time of day.
- Write it short
Most important part first, no "image of":
alt="Mountains at sunset".
Which alt text helps most?
A picture with a caption
<figure> groups a picture with its caption, <figcaption>. Everyone sees the caption; alt replaces the picture. Both help.
<figure>
<img src="city.jpg" alt="A city seen from a tall tower">
<figcaption>The city from above.</figcaption>
</figure>
Your turn: answer the question, run the code, then fix it one check at a time.
A link and a picture
Lena (a fictional learner) wrote a section about her favourite place. Help her finish it: describe the picture, give it a size and a caption, and make both links clear.
Video, audio and other pages
<video width="320" height="180" controls>
<source src="clip.mp4" type="video/mp4">
<source src="clip.webm" type="video/webm">
Your browser cannot play this video.
</video>
controlsadds play, pause and volume buttons. Always add it.autoplaystarts alone. Avoid it: many browsers block it when there is sound. If you use it, addmuted.looprepeats;preloadis only a hint.- Each
<source>is the same file in another format. The browser plays the first one it can; the text shows only if it can play none. <audio controls>works the same way. For MP3 the type isaudio/mpeg.
People who cannot hear, or who are in a quiet place, read captions. A caption file goes into the video with <track kind="captions">.
<iframe> shows another page inside yours. Its title tells screen reader users what is inside. Nothing goes between the tags.
<iframe src="https://example.com" title="Example page"></iframe>
Outside pages, videos and sounds are blocked here for safety, so you see empty boxes. The checks read your code.
For the curious: <source> for pictures
The slides say <source> can also choose a picture for the screen size. That happens inside <picture>, with the attributes srcset and media.
Slide bug: media fixes
This code is built from the course slides on video, audio and frames. One line has a bug from the slides, and we hid two more. Tap a line to check it, then choose the fix.
Key words
- Link
- Text that takes people to another place when they tap it:
<a>. - Alt text
- Words that replace a picture for people who cannot see it.
- Caption
- A visible line that explains a picture.
- Controls
- The play, pause and volume buttons of a player.
In short
<a href="...">makes a link; its text says where it goes.<img>needssrcandalt;widthandheightkeep its space.<figure>and<figcaption>give a picture a caption.- Video and audio need
controls; an iframe needs atitle.
Tables: rows, columns, a caption and cells that cover two columns.
Sources
- MDN Web Docs (2026). Creating links.
- MDN Web Docs (2026). HTML images.
- MDN Web Docs (2026). HTML video and audio.
- MDN Web Docs (2026). <video>: The Video Embed element (autoplay, preload).
- MDN Web Docs (2026). <iframe>: The Inline Frame element (title).
- W3C WAI (2024). An alt Decision Tree.
- W3C (2023). Understanding Success Criterion 1.4.2: Audio Control.
End of the lesson
This lesson: 0 of 95 XP
Code Cards in this lesson: 7
<a>href="#id"mailto:<img><figure><video><iframe>