HTML5 introduces a number of semantic elements that act as structural containers for different parts of web pages:
Contains introductory and / or navigational content.
<header> may be used multiple times on a page, and have multiple contexts: for example,
<header> may be used immediately after the opening
<body> tag to contain the main banner and navigation of the site, and could be used again inside a
<article> to introduce new content.
<header> will usually appear at the top of the page, but it doesn’t have to: its position and appearance are determined by CSS.
<header> should not be confused with
<head>. Nor is
<header> a heading element, like
<h6>. It is most akin to a masthead.
Probably the most poorly named of the new tags (an aside is a stage direction or a type of dialogue),
<aside> is meant to contain tangentially related information about the document. Asides could be pull quotes, a colophon, or other information. Asides are most akin to a sidebar, but they are not restricted to any particular position on the page.
Intended for major site navigation containing a series of links. In HTML5, this replaces the unordered list navigation structure we were using previously.
A container for a group of related content. A successor to the generic
<div> tag, although
<div> still exists in HTML5.
A grouping of self-contained content, such as a blog post. New developers tend to get confused between
<article>: the difference is the emphasis on self-containment. If content could be understood by itself, with no external context required – if it could be taken out an published in an RSS feed, for example – it is an article. Otherwise,
<section> or another container element is more appropriate.
Adding to the confusion is the fact that articles could also be widgets, or web applications, such as calculators, weather reports, etc. Again, the emphasis is on self-containment: an
<article> containing a weather report for Auckland, New Zealand could be moved from one site to another without requiring any additional content or explanation of context.
Also note that an
<article> nested inside another
<article> is, by definition, assumed to be a comment on the parent
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.