HTML <section> / <article> tags
- closing tag
- required
- void element
- no
- lives inside
- <body>, usually inside <main>
- typically holds
- a heading plus the content that belongs under it
Where it goes
Inside <main>. They can nest: an <article> can hold <section>s, and a <section> can list <article>s. Each one should start with a heading (<h2> or lower). If you cannot think of a heading for it, it is probably a <div>.
Example
<main>
<section>
<h2>Latest posts</h2>
<article>
<h3>Why I switched to Linux</h3>
<p>It started with a broken update...</p>
</article>
</section>
</main>Open this example in the editor →
Common mistakes
- Using <section> as a plain wrapper for styling. If it has no heading and no theme, it is a <div>.
- Picking <article> because something feels important. The test is: would this still make sense on its own page? A pricing block would not. A blog post would.
- Putting a new <h1> inside every section. Keep one <h1> per page, and use <h2> and <h3> inside sections so the levels still describe the structure.