Module lessons (4/4)
Lists, Images & Accessible Media
Three List Types for Three Distinct Meanings
Using CSS bullet styles on <div> elements loses list semantics: screen readers tell users "List, 4 items" and allow skipping past long lists cleanly.
| Element | Meaning | Allowed Direct Children |
|---|---|---|
<ul> | Bullet collection where item order doesn't change meaning | <li> only |
<ol> | Sequential recipe steps, checklists, rankings (start, reversed) | <li> only |
<dl> | Glossary terms (<dt>) paired with descriptions (<dd>) | <dt>, <dd> (or <div> wrappers) |
Accessible Images: When alt Should Be Descriptive vs Empty ("")
Every <img> must carry an alt attribute—no exceptions:
- Informative image (photo, chart, icon-only button): describe what the image communicates concisely, skipping filler words like
"image of"or"photo showing". - Decorative image (abstract corner flourish, icon sitting beside already clear visible label text): use empty
alt=""so screen readers silently skip it instead of cluttering speech with repetitive descriptions.
<!-- Informative: concise meaning -->
<figure>
<img
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120'%3E%3Crect width='240' height='120' fill='%230284c7'/%3E%3C/svg%3E"
alt="Quarterly revenue climbed 28% between Q1 and Q2"
width="240"
height="120"
/>
<figcaption>Figure 1: Q1–Q2 subscription growth.</figcaption>
</figure>
<!-- Decorative: blank alt skips redundant noise -->
<button type="button">
<img
src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
alt=""
width="16"
height="16"
/>
Download CSV
</button>Step 1 — Convert unordered bullets and manual numbering into true lists
Replace the manual numbered <p> steps inside <section class='recipe'> with a proper <ol> containing three <li> items.
Show hint
Replace the three <p> step lines with <ol> and put each instruction inside <li>...</li> (no manual 1. 2. 3. numbers needed!).
Solution available after 3 attempts
Step 2 — Add accessible alt attributes and intrinsic dimensions
Add meaningful alt text plus width='320' height='180' on .chart-img, and set alt='' on .decorative-dot.
Show hint
Put alt="" on .decorative-dot and write descriptive alt text plus width="320" height="180" on .chart-img.
Solution available after 3 attempts
Step 3 — Pair specification key-values with <dl>, <dt>, <dd>
Replace the spec <div> rows inside <section class='specs'> with a <dl> containing two <dt> terms ('Resolution' and 'Refresh Rate') and matching <dd> values.
Show hint
Put both pairs inside <dl> with <dt>Resolution</dt><dd>5120 x 2880</dd> and <dt>Refresh Rate</dt><dd>120Hz</dd>.
Solution available after 3 attempts
What is the right alt attribute for a small star icon placed immediately beside the visible word 'Featured' inside a heading?
Why should HTML include width and height attributes on <img> even when CSS later makes the image responsive (width: 100%; height: auto)?