HTML and CSS Reference
belong to the sectioning content model. HTML5 also introduces new elements for marking a header or
footer within one of these sections, or for the entire document.
Before the advent of HTML5, you would have probably used a generic division (the div element, covered
later in this chapter) in place of every one of these structural elements, and you still can. But a div
element is semantically shallow. It's useful for collecting related content into a nonspecific box, but a div
says nothing else about what that content means or what purpose it may serve. These new sectioning
elements each have a specific meaning and serve a specific purpose.
All of these elements require end tags, and there are no required or optional attributes for any of them,
apart from the standard global attributes.
The section element defines just what it says: a section of content. But rather than a completely generic
box, the section element groups thematically related content . It collects content that, when taken together
as a whole, serves a single purpose or is related to the same topic. That's still a pretty vague definition,
and deliberately so. The section element is multi-purpose, and can be applied in a number of situations.
It defines a section of thematically related content, but not any particular kind of content.
In Listing 4-1 you see a basic HTML document with its content divided into three sections: an introduction,
recent news, and some general information. This document is pretty light on content, but if you imagine it
filled with lengthy blocks of text, you can see how breaking it down into a few relevant chunks via section
elements could help you keep things organized. A section element should usually begin with a heading
(covered later in this chapter) to introduce the content, but that isn't a requirement.
Listing 4-1. An HTML document split into three major sections
<title>Power Outfitters - Superhero Costume and Supply Company</title>
<p>Power Outfitters offers top of the line merchandise at
rock-bottom prices for the discerning costumed crime-fighter.
From belts to boomerangs, we're your one-stop shop for all
your specialized gadgetry and costuming needs.</p>
<p>Small things, big savings. All shrink rays are on sale,
this week only!</p>