files/en-us/web/html/reference/elements/section/index.md
The <section> HTML element represents a generic standalone section of a document, which doesn't have a more specific semantic element to represent it. Sections should always have a heading, with very few exceptions.
{{InteractiveExample("HTML Demo: <section>", "tabbed-standard")}}
<h1>Choosing an Apple</h1>
<section>
<h2>Introduction</h2>
<p>
This document provides a guide to help with the important task of choosing
the correct Apple.
</p>
</section>
<section>
<h2>Criteria</h2>
<p>
There are many different criteria to be considered when choosing an Apple —
size, color, firmness, sweetness, tartness...
</p>
</section>
h1,
h2 {
margin: 0;
}
This element only includes the global attributes.
As mentioned above, <section> is a generic sectioning element, and should only be used if there isn't a more specific element to represent it. As an example, a navigation menu should be wrapped in a {{htmlelement("nav")}} element, but a list of search results or a map display and its controls don't have specific elements, and could be put inside a <section>.
Also consider these cases:
To reiterate, each <section> should be identified, typically by including a heading ({{HTMLElement("Heading_Elements", "h1")}} - {{HTMLElement("Heading_Elements", "h6")}} element) as a child of the <section> element, wherever possible. See below for examples of where you might see a <section> without a heading.
<div>
<h2>Heading</h2>
<p>Bunch of awesome content</p>
</div>
{{EmbedLiveSample('Before')}}
<section>
<h2>Heading</h2>
<p>Bunch of awesome content</p>
</section>
{{EmbedLiveSample('After')}}
Circumstances where you might see <section> used without a heading are typically found in web application/UI sections rather than in traditional document structures. In a document, it doesn't really make any sense to have a separate section of content without a heading to describe its contents. Such headings are useful for all readers, but particularly useful for users of assistive technologies like screen readers, and they are also good for SEO.
Consider however a secondary navigation mechanism. If the global navigation is already wrapped in a <nav> element, you could conceivably wrap a previous/next menu in a <section>:
<section>
<a href="#">Previous article</a>
<a href="#">Next article</a>
</section>
Or what about some kind of button bar for controlling your app? This might not necessarily want a heading, but it is still a distinct section of the document:
<section>
<button class="reply">Reply</button>
<button class="reply-all">Reply to all</button>
<button class="fwd">Forward</button>
<button class="del">Delete</button>
</section>
{{EmbedLiveSample('Using a section without a heading')}}
Depending on the content, including a heading could also be good for SEO, so it is an option to consider.
{{Specifications}}
{{Compat}}