Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Another new element that's going to help out greatly with structuring page content is the aside element. The aside element allows us to mark up content that is tangentially related to the content around it. This can be very helpful when defining content relationships. Now, we can see this from the specification that the aside element belongs to both Flow and Sectioning content. One thing that I just want you to keep in the back of your mind is that the nav element, article element, sectioning element, and now the aside element, all of these also belong to Sectioning content, so just kind of file that away for later.
If I scroll down a little bit, we can see the description here, and the aside element represents a section of the page that consists of content that is tangentially related to the content around the aside element. Here is a really important part though, "which could be considered separate from that content." So again, it's only partially related to the content around it. As it mentions here, such sections are often represented as sidebars in printed typography, and to be honest with you, that's how I see most people using this element; most people use the aside to represent a sidebar. I certainly do it myself. However, it can be used for a lot more than that.
Notice it can be used for typographic effects like pull quotes, advertising, groups of navigational elements, like in a blog for example, all the blog roll links that you have on the left-hand side, those could be in an aside element because they're related to the content around them, but they are not specific to it. And again, notice that it says in description here, "for other content that is considered separate from the main content of the page." It's got a couple of examples here. Most of them do exactly what you think they would do. It basically describes--this example shows how an aside is used to mark up background material on Switzerland in a much longer news story on Europe.
So again, background material in Switzerland would relate to a news story on Europe, but it wouldn't be absolutely required for you to understand the content of the article. They have asides marking up pull quotes, and they also have them for marking up blog rolls and other side content that you might have on a blog. So they have got a couple of very useful examples here as well. We'll be using the aside element multiple times in our title, and occasionally we are going to be using it as a root-level element, meaning it's right there inside the body tag, and other times we are going to be using it inside, or nested inside, of other elements.
And where you have the aside tag really dramatically affects its meaning. So as we go through the course, and we go to the title, and we use the aside tag, I will make sure that I discuss that, that in terms of where the aside elements is used dramatically affects the meaning and the relationship of the content around it. So let's go back to our HTML5 file, and we're going to use our aside element on our HTML5 page. Now, this from the 02_07 folder. This is as html5.htm. And I am going to do basically what everybody else does with this.
I am going to go right down here, find my sidebar. So in the sidebar, we have monthly specials, different tour specials that are going on with our company. Now, although it's related to the rest of the content on the page because it is tours, that this company sells tour packages, it is independent of it, and it is only tangentially related to it. So that actually is a really good example of the section of content that could benefit from the aside tag. So I am going to go ahead and do an opening and closing aside tag, and I do want to get rid of this hidden attribute. The hidden attribute is a new attribute in HTML5, and it essentially hides the content of the page until you reestablish it later on through scripting. So it's kind of like being able to hide a widget until somebody wants to do something with it, and the widget appears again.
But we don't need to do that with our sidebar. We want our sidebar. So we are going to replace the div with the aside and get rid of that element. Now, I mentioned just a second ago that where you use the aside element dramatically affects its meaning. Because this is used right on the body element, meaning it's not nested inside of any other element, that means that the contents of the aside element should relate to the entire page content--so not just one section of the page, it should relate to the entire page. So in this case, because our sidebar relates to the entire page around it, we used the aside element for it.
I'm sure just like this page, you've often seen asides used in the place of sidebars. Now, this is legitimate use for it, but there is a reason it is not named the sidebar element. Now, just keep that in mind when you are deciding to use it or not, that it is designed to identify content related to the content surrounding it, and if you do that, you are going to be using the element correctly.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 93523 Viewers
82 Video lessons · 104382 Viewers
71 Video lessons · 76510 Viewers
56 Video lessons · 107830 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.