Essential storage keeps sign-in and learning features working. Google Analytics measures visits; Microsoft Clarity records interactions to help us improve usability. Both are optional and stay off until you choose. Read our privacy policy.
Repair a heading outline coding exercise | SovranCode
Study the question, then follow the complete answer and its reasoning.
01 · QUESTION
What should the HTML contain?
Turn visually emphasized text into a logical heading hierarchy for a city cycling guide. The outline should make sense even when read without the paragraphs.
Requirements
Use exactly one h1
Use two h2 elements for the major sections
Use two h3 elements beneath Choose a bicycle
Remove strong elements used as headings
Key idea
Use one h1 for the page, h2 for major topics, and h3 for subsections within a major topic.
02 · SOLUTION
Complete HTML answer
<main>
<h1>City cycling guide</h1>
<section>
<h2>Choose a bicycle</h2>
<h3>Commuter bikes</h3>
<p>Comfortable for everyday journeys.</p>
<h3>Folding bikes</h3>
<p>Compact for mixed-mode travel.</p>
</section>
<section>
<h2>Plan a safe route</h2>
<p>Prefer calm streets and protected lanes.</p>
</section>
</main>
03 · EXPLANATION
Why this solution works
The h1 names the page. Each h2 begins a major section, and each h3 names a subsection inside the first h2. Strong indicates importance within prose; it does not create a navigable section or heading in the document outline.
Concepts demonstrated
Choose heading levels by hierarchy
Create a scannable page outline
Avoid presentational heading substitutes
Why this pattern matters
Headings form a navigable outline of a page. Readers scan them visually, and screen-reader users can jump through them as a list. When bold text merely looks like a heading, that structure disappears; when levels are chosen only for size, the resulting outline describes the wrong relationships.
Solution walkthrough
The single h1 states the overall subject of the city cycling guide.
Each h2 names one major topic directly beneath the page subject.
The two bicycle types use h3 because they belong inside the first h2 section.
Paragraphs remain ordinary supporting prose beneath the headings they explain.
Common mistakes to avoid
Replacing headings with strong or large styled paragraphs
Skipping levels to obtain a preferred default size
Using several h1 elements without a clear document reason
EXERCISE FAQ
Before you move on.
What does “Repair a heading outline” teach?
This beginner HTML exercise focuses on Choose heading levels by hierarchy, Create a scannable page outline, Avoid presentational heading substitutes. Its requirements define the exact behavior to implement before you write code.
How should I validate this HTML solution?
Start with the displayed example input and expected output, then test a boundary case suggested by the requirements. Edit the HTML, inspect the live preview, then run the checks before comparing your structure with the complete answer.
When should I open the reference solution?
Attempt Repair a heading outline first. Then open the read-only solution file to compare the contract, edge-case handling, and implementation choices—not simply to copy the final code.