Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
For the most part, once you learn the basics of the outline algorithm, structuring your documents properly requires only a minimal amount of planning. There are times, however, that certain nesting requirements, or element types, makes giving the proper outline rather tricky. Now, let's take a look at some of the issues that you need to consider when structuring more complex documents. So here I am again at the HTML5 Outliner, but I have cheated a little bit. Let me show you. So if I scroll down into this coding section, you can see that I have already sort of entered some of code in there. Now if you want to do this along with me, what I am going to do is scroll down so you can see the code I have added, and you can pause the video and go ahead and code that.
I just think that probably watching the code is pretty boring. I am going to scroll down a little bit, and here's what I added to it, and this is all of the code that I have added. So go ahead and pause your video, type this in, and then we'll start back again. Okay, so let's a take a closer look at the actual structure here. So we have our main page title, which is Explore California, and inside that, we have a section. So inside the Our Tours section, we have an article that includes Our Tour Reviews, and the Tour Reviews have currently two tours that we have reviews listed for.
We have Cycle California and Backpack Cali, and each of them have just a couple of tours added. Now, if I outline this, you can see that I get the document structure that I'm anticipating. We have the Explore California as the title of the page, the Our Tours, which is the section, Tour Reviews is the article, and then it has individual sections inside of it: Cycle California and Backpack Cali. Now you can kind of see the strategy I am using for my headings. Anytime I have a new section, such as article here, I am starting off with an h2 tag. So my section that's nested inside here gets an h2, and inside the article, I get an h2.
Now essentially, after that I am going just use the regular heading hierarchy to nest my sections. Now, you can see I am already on h4, so if this was going to be a really complex page structure, I may need to rethink this, because my headings only go to h6. All is well and good at the moment, but what if somebody comes along, my client, and says, "Hey, you know we've got this really urgent note that we want to pass along about a charity," for example, "that's going to help update or save endangered hiking trails"? In their desire to get the right people read it, they want to place this note right here with the Backpack Cali reviews, which kind of makes sense. But if you think about this, it's not exactly a tour review, so it's just sort of related content.
Now, we know from some of the tags that we studied or talked about earlier that one of the great semantic tags that we have now is an aside tag, which allows us to basically describe tangentially related content, and that's what I am going to use here. So I am going to inside the h3, and tabs don't really work here, so I am just going to hit the spacebar to sort of nest this, essentially. And what I am going to do is right here at h3, I am going to go in and create an aside tag. Inside the aside tag, I am just going to have a heading 2. Remember, the aside tag is sectioning content, so I am going to create a new section. So I am going to do an h2 and I am just going to going to say, "Help save our trails." It would be a more complex structure than that.
We would also have some paragraphs and maybe even a form or something like that for the people to fill out, but then I am just going to close the aside tag. So again, notice the location of the aside tag. It is nested inside of the article. It comes directly after the Backpack Cali. So if go ahead and outline this, something bad just happened to my document outline. Notice now that Hiking Big Sur, Ojai Hills, LA Urban Hikes, they're all actually on the same level as Backpack Cali, whereas, really, I just want Help Save our Trails to sort of interrupt the document flow, but I want to go right back to it afterwards.
Well, maybe the heading is at fault. So if I go back, I can see that we sort of had an h2 there, but what if I go down to say an h4? That would put this heading on the same level as these guys, right? If I outline that, it doesn't work either, and it doesn't work because remember, anytime sectioning content is encountered, a new section is created and the top heading in that section is used to title it. So the level of the heading in this case doesn't really matter. So the problem here is, by interrupting the sequence with the sectional content, we have separated the ranking values of the headings, right? So remember, headings create implicit sections, and then subsections based on rank, but they have to be sequential.
So once they're interrupted the way we're interrupting them here, essentially all these sections remain at the same level in the outline because they are just reestablishing them. Because these are all h4s, they are reestablishing a new section after the aside, but because these are all h4s, they remain on the same level. So the heading that we used inside the aside obviously doesn't matter. So if we wanted to reestablish that flow, maybe the aside isn't the element to use. What if we use a div? Remember, divs are just generic sectioning content. So let's try a div there. Okay, now I am back to getting what I want. Help Save our Trails is inside Backpack Cali, along with the other guys.
You know, that sort of brings up a bigger problem. I want to use the aside element. You know the aside element is supposed to be for tangentially related content. It describes meaning. It helps, gives meaning to the content. The div tag doesn't do that at all, so the aside element is really what I need there. So I am going to go back to aside element. And I am even going to go back and do an h2, because since it's a new section, you always start new sections using the ranking that we are doing with an h2. All right, so what's the problem? So the problem isn't so much with the aside itself. It really isn't.
It's with trusting the headings to create implicit sections. Now, this initially may create much cleaner code, because we can just do our headings h2, h3, h4. It does lack the flexibility that we need if we need to interject new sectioning content into our layout. So we are going to modify our code a little bit so that we can say, have our cake and eat it at the same time. All right, so I am going to go back at the Tour Reviews. Now remember, inside Tour Reviews, we have essentially two sections: Cycle California and Backpack Cali. So I am going to just do that.
I am going to go ahead and wrap those in section tags. So just inside Tour Reviews, I am going to enter my first section. And since that section is Cycle California, we'll go ahead and enclose that in a section tag. And then we're going to do the exact same thing for Backpack Cali. So now instead of letting the headings form implicit sections, we're being explicit in the sections. We're taking control of that, essentially. And then after my LA Urban Hikes, I will go ahead and close that section. Just to make things look a little neater, I will go ahead and add some spaces there to nest that as well.
So notice that now we have, not implicit sections being created by our headings, but we have a very explicit section that we have created. And so, because of this now, if I outline it, I get exactly what I'm looking for, because we have an individual section here and now an individual section here, and the aside is not sort of breaking those implicit sections being created. So by enclosing both the tours and the reviews in a section element, not only do we logically organize the content, but we are explicitly creating the structure that we need for the Tour Reviews article.
Now that's not to say that using headings to create implicit sections is wrong. I certainly agree that in many cases less is more, and you don't want to add additional structure just for the sake of structure if you don't have to. I hope this illustrates for you how important it is to not only put a lot of thought into what your document outline should look like before you begin coding, but also what structures are going to be required to achieve the proper outline based on the complexity of the content or additions to it later on down the line.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 92496 Viewers
82 Video lessons · 104138 Viewers
71 Video lessons · 75617 Viewers
56 Video lessons · 106988 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.