Please note, that the content model of footer has now been updated to reflect that of header, so you can have
headings in your
footers. For more information, please read my updated article The Footer Element Update. and read the tracking note.
For some time now we’ve become accustomed to seeing
<div id="footer"> at the bottom of web pages but with the introduction of HTML 5 it’s time to say goodbye. With the addition of the new
<footer> element we now have more scope and flexibility.
According to the spec
The footer element represents the footer for the section it applies to. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
Lets get started
Before we get stuck into dissecting the new element, let’s lay the foundations for the article and cover the basics. As we’ve already mentioned above, most people would have laid out the footer as follows
<div id="footer"> <ul> <li>copyright</li> <li>sitemap</li> <li>contact</li> <li>to top</li> </ul> <div>
However with the creation of HTML 5 this is no longer the case. As you may already know, there is now no longer the need for the
<div> element for many elements. In our case, when referring to the footer, the appropriate markup would be
<footer> <ul> <li>copyright</li> <li>sitemap</li> <li>contact</li> <li>to top</li> </ul> </footer>
As I mentioned in the first paragraph, originally the
<footer> element was only utilised once within our pages but with the introduction of the new element, this no longer needs to be the case. The
<footer> element can now be used multiple times and to display all the extra information.
Using the footer element
An important point to note is that you are not restricted to use one
<footer> element per site, you can use multiple footers, each of which will then become the
<footer> for that section of the document. You could therefore have
<section> Section content appears here. <footer> Footer information for section. </footer> </section>
<article> Article content appears here. <footer> Footer information for article. </footer> </article>
To see an example of the
<footer> within an article/section look no further than this very page. Scroll down beyond the article and you will notice the light grey text section, which falls directly after the “further reading”. This grey text section which gives information about trackbacks, responses, tags and categories is infact using the footer element.
We’ve already outlined what the new footer can look like above.
I was initially thrown off-course by the presentational name of the element; my use here isn’t at the bottom of the page, or even at the bottom of the article, but it certainly seems to fit the bill – it’s information about its section, containing author name, links to related documents (comments) and the like. There’s no reason that you can’t have more than one footer on page; the spec’s description says “the footer element represents a footer for the section it applies to” and a page may have any number of sections. The spec also says “Footers don’t necessarily have to appear at the end of a section, though they usually do.”
The footer element offers the chance to define web pages giving them the correct semantic mark-up that they deserve but it’s vital to use these new found tags as they were intended for. Let’s not get carried away and misuse this tag like we have done with tables and divs.