Skip to content

HTML container tags

New Courses Coming Soon

Join the waiting lists

Discover how to use container tags in HTML and find out which one to choose

Container tags

HTML provides a set of container tags. Those tags can contain an unspecified set of other tags.

We have:

and it can be confusing to understand the difference between them.

Let’s see when to use each one of them.


The article tag identifies a thing that can be independent from other things in a page.

For example a list of blog posts in the homepage.

Or a list of links.

		<h2>A blog post</h2>
		<a ...>Read more</a>
		<h2>Another blog post</h2>
		<a ...>Read more</a>

We’re not limited to lists: an article can be the main element in a page.

	<h2>A blog post</h2>
	<p>Here is the content...</p>

Inside an article tag we should have a title (h1-h6) and


Represents a section of a document. Each section has a heading tag (h1-h6), then the section body.


	<h2>A section of the page</h2>
	<img ... />

It’s useful to break a long article into different sections.

Shouldn’t be used as a generic container element. div is made for this.


div is the generic container element:


You often add a class or id attribute to this element, to allow it to be styled using CSS.

We use div in any place where we need a container but the existing tags are not suited.

This tag is used to create the markup that defines the page navigation. Into this we typically add an ul or ol list:

		<li><a href="/">Home</a></li>
		<li><a href="/blog">Blog</a></li>


The aside tag is used to add a piece of content that is related to the main content.

A box where to add a quote, for example. Or a sidebar.


  <p>some text..</p>
    <p>A quote..</p>
  <p>other text...</p>

Using aside is a signal that the things it contains are not part of the regular flow of the section it lives into.

The header tag represents a part of the page that is the introduction. It can for example contain one or more heading tag (h1-h6), the tagline for the article, an image.

	  <h1>Article title</h1>


The main tag represents the main part of a page:


The footer tag is used to determine the footer of an article, or the footer of the page:

    <p>Footer notes..</p>
→ Get my HTML Handbook
→ Read my HTML Tutorial on The Valley of Code

Here is how can I help you: