HTML Section and Article: Organize Content
Group a topic with section
A section groups related content around a theme, usually with a heading. Use it when a distinct topic belongs in the document structure. For a wrapper needed only for styling, use div instead. Choose heading levels from the actual page hierarchy.
<main> <h1>Community center</h1> <section> <h2>Classes</h2> <p>Painting every Monday.</p> </section> <section> <h2>Facilities</h2> <p>Two meeting rooms.</p> </section></main>Two topics are grouped beneath the page heading.
Use article for independent content
An article is a composition that makes sense on its own, such as a news story, a product review or a forum post. It can include its own heading and sections. A list of independent posts can use one article per post. A section is not automatically an article just because it has a heading.
<main> <h1>Community news</h1> <article> <h2>Park reopens</h2> <p>The gates open on Saturday.</p> </article> <article> <h2>Book exchange</h2> <p>Bring a book on Friday.</p> </article></main>Each short news item is an independent composition.
Name a significant section
A section with an accessible name can be exposed as a region landmark. Use aria-labelledby to reference the ID of its visible heading. This attribute tells accessibility tools where to get the name; the ID must exist and be unique. Not every small section needs to become a landmark, because excessive landmarks make navigation noisy.
<main> <h1>Visitor guide</h1> <section aria-labelledby="access-title"> <h2 id="access-title">Accessibility</h2> <p>A step-free entrance is on the east side.</p> </section></main>The section can be exposed as a region named Accessibility.
Common mistakes and practice
Do not wrap every paragraph in section or every card in article. Choose based on meaning. Do not rely on nesting to change h1 into h2; use explicit heading ranks. Practice by grouping a guide and an independent news item.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Section and Article: Organize Content — Knowledge Check
Apply the semantic HTML and page structure concepts from this lesson.
Which content is a strong candidate for article?
What does aria-labelledby="hours" refer to?
Which element is usually best for a wrapper used only for styling?
When should a thematic section have a heading?
Which example is more naturally an article than a generic section?