HTML Aside: Related and Complementary Content
Identify complementary content
An aside contains content related indirectly to its surrounding content, which can usually be separated without losing the main meaning. Examples include related reading, background facts and a glossary note. It is not a command to display content at the side of a screen; layout belongs to CSS.
<main> <h1>Planting herbs</h1> <p>Choose a sunny spot and water the soil.</p></main><aside> <h2>Related reading</h2> <p>Guide to garden tools.</p></aside>The aside is useful but not essential to the planting instructions.
Keep a note in its article context
An aside may appear inside an article when its content relates to that composition. If a warning or a required step is essential to understanding the article, keep it in the main article flow instead. Avoid using aside just because a box has a border. For accessibility, prefer top-level complementary landmarks when practical; deeply nested landmarks can be harder to navigate.
<main> <article> <h1>Make a paper lantern</h1> <p>Fold the paper and cut along the marked lines.</p> <aside> <h2>Background</h2> <p>Paper lantern styles vary by region.</p> </aside> </article></main>The background note belongs to the article, but is separate from the steps.
Distinguish multiple complementary regions
A page can have multiple aside regions. Give them distinct accessible names using aria-labelledby when visible headings exist. This helps users distinguish complementary landmarks. A visible heading also helps sighted readers understand the region.
<main> <h1>Travel guide</h1> <p>Explore the historic district.</p></main><aside aria-labelledby="tips"> <h2 id="tips">Local tips</h2> <p>Carry a water bottle.</p></aside><aside aria-labelledby="reading"> <h2 id="reading">Further reading</h2> <p>City history.</p></aside>The complementary regions have different names: Local tips and Further reading.
Common mistakes and practice
Do not put essential instructions in aside merely to style them as a sidebar. Avoid duplicate region names when the content differs. Practice by moving a nonessential fact outside the main article.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Aside: Related and Complementary Content — Knowledge Check
Apply the semantic HTML and page structure concepts from this lesson.
Which content belongs naturally in an aside?
Does aside automatically appear on the right of a page?
How can two complementary regions be distinguished?
Where should essential instructions for the main task appear?
What does the choice of aside communicate?