Elements, attributes, and nesting
See element boundaries and write correctly nested markup.
- Difficulty
- beginner
- Time
- 35 minutes
- Last verified
- 9/21/2026
What you will build
Add a progress card and read parent-child relationships from indentation.
Understand the idea first
The hard part is often seeing where an element ends. Think in boxes: an element contains text or other elements. Align siblings and indent children by two spaces.
Build it step by step
<section id="progress" aria-labelledby="progress-title">
<h2 id="progress-title">Learning progress</h2>
<p>Now learning: <strong>HTML basics</strong></p>
<p>Completed: <progress value="2" max="12">2 / 12</progress></p>
</section>- Place the code after
h1and before the closingbodytag. - Trace from
<section>to</section>, then check each paragraph. - Change the progress value to 3 and update its fallback text too.
- Temporarily remove a closing paragraph tag, observe browser error recovery, then restore it.
Read the important lines
sectionis the parent; the heading and paragraphs are children.- Attributes live in the opening tag. An
idmust be unique. strongconveys importance rather than merely bold styling.
Common mistakes and what to check
| Symptom | What to check |
|---|---|
| Crossed closing tags | Close the element opened most recently first. |
| Duplicate ids | Each id must identify one element. |
| Indentation hides the structure | Format the document and align siblings. |
Practice without copying
Add a sibling paragraph with data-status="learning" and mark “practising consistently” as important.
Check the answer after you try
Use <p data-status="learning">Status: <strong>practising consistently</strong></p>.
Completion check
- My page contains the required new content
- I can explain the key tags or attributes without the answer
- I deliberately created and fixed at least one error