Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Much as with headers, it's important to look at footers as more than just a place to put closing content. Footers can have a rich structure all of their own, and as we are going to see, can be used in some pretty surprising ways. So, what we want to do now is structure the footers for our trails page, and this is one I have opened up from the 04_09 folder, so that's where you can find this example. Since we are structuring footers, I am going to start at the bottom of the page. That's where our page footer is. So I am going to scroll down, and you can see that in this file we have added some content down there for the footer. Now, let's take a look at the content.
We have return to top, which is obviously a link back up to the top of the page for people that have scrolled down. We have telephone numbers, email links, some legal content, Explore California, the address, some phone numbers. Now, again exposing this in outline, it's a judgment call. Some people might want the contact info, at least the address, listed in the document outline. In this case, I don't. I don't want that in the outline. It's footer information for people that scroll down. They can read through it, but I don't really need to jump down to it. I don't need it to be exposed in any way, especially since in my site I would probably have a contact page where someone would navigate to do that in a more thorough way.
The first thing I am going to do is just structure each of these elements, and I am going to start with this link that's going to return us to the top of the page. So, I am going to go ahead and wrap that in a paragraph, and in addition to a paragraph, I need to make this a link. So I am going to go ahead and create a link. The href attribute for this is actually going to go up to main header. Now, you may have remembered earlier, we gave the top header an ID of mainHeader, so this is going to link right back up to that. It's another perfect use case of using IDs. That's a perfect reason to use them.
So, we will go ahead and close that out and then close the link. Okay, cool! Next thing I am going to do is for my telephone, I am going to wrap that in a paragraph as well, and we are going to use something kind of interesting here for telephone. So I am going to go ahead and wrap this first in a paragraph, and then I am going to come in and I am also going to wrap it in a link. Here, I am going to do another href attribute, but the href attribute isn't going to be your normal link. So I am going to use the tel link, and essentially, this is going to be for mobile devices. This will make the link clickable in a mobile device and go ahead and dial this number. So I am just going to do tel://866-555-- which of course isn't a real number so don't try to dial it-- -4310. Okay cool! I'll go ahead and give that a title as well, and I am just going to title this, "give us a call." Now, I am going to do the same thing here for my explorecalifornia info.
I'll go ahead and first initially wrap that in a paragraph tag and then of course, I will do a nice little link here, href, and we are just going to do a mailto link. So we will do mailto, and we will just use the email address, email@example.com. Now, this is bad practice. You don't want to do this if you can avoid it because this is going to get spammed all to pieces, but again, this is just an example of structuring the footer. The next I am going to do is the all content and the copyright data. We are going to wrap that in a paragraph. So you can see everything is being wrapped in a paragraph.
So, both of those lines are wrapped in a single paragraph, and then after the street address, I am just going to go ahead and do a line break there. I am going to do the same thing for the phone number. So they both get wrapped in a paragraph tag, and then we are just going to throw in a line break right after the initial telephone number. Okay, cool! Now, let's go ahead and save that. And we have one more footer that we need to do. I am going to scroll up into our main article, and we can see that some additional content has now been added to the main article. So after Final thoughts, we now have this About the author: Jeff Layton lives in Ventura, California.
And one of the things that we can remember from the specification is that contact information, or information about the author, the article, is really perfect for a footer. So a footer would be a very logical element to place here, but you might be saying yourself, well, wait a second, though. This is in the Trail Review section, which is also in its own individual article, and it's not at the bottom of either of those because the Comment section is coming below that. Well, that's okay; remember, footer elements do not have to be at the bottom of an element. Often they're encountered there, but they don't have to be. So, in this case, we are going to go ahead and put a footer, even though it's not quite at the bottom of our content.
So, the footer is going to go around 'about the author' and then the paragraph 'Jeff Layton lives in Ventura, California'. Now, again, these are the things that I don't really necessarily want to have show up in the outline. So, instead of using a heading for them, I'm going to be using paragraphs for both of these. So, opening and closing paragraphs for both of those, and we will also go ahead and do a quick little mailto link right around his email address. So a tag, do a little href, mailto:firstname.lastname@example.org.
The delicious irony of course is that that's not a real email address so the spam box will have fun sending content into the ether. Okay, now I am going to go ahead and save this, and again, if I preview this in my browser and check the outline, we haven't affected the outline at all. We don't see anything about the author. We don't see anything at the bottom about our contact information. So our footers are fully structured and presenting information the way we want it to be presented, but they are not showing up in the document online, which again, is what we want for this particular document. Now, keep in mind, just like we've previously discussed, footers aren't considered sectioning content; that's why we don't see them in the outline.
Now if you want the contents of the footer exposed in the document outline, you are going to have to add the proper sectioning elements to the footer's content. You can put it an aside in a footer. You could put an article or a section in a footer. A section is probably something that's probably a little bit more logical. Or you could just go ahead and do implicit sectioning using headings. You should also remember that footers don't have to appear at the bottom of the element, just that the content inside of them needs to fit the suggested content type for footers--the information about the author, related links, legal data, indexes, things like that.
Okay, now that we've finished the basic structure of our site, it's time to return our attention to some of the new or modified grouping elements in HTML5, and we are going to go ahead and begin that process in our next chapter.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98482 Viewers
61 Video lessons · 85764 Viewers
71 Video lessons · 69669 Viewers
56 Video lessons · 101993 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.