Checking document outlines
Video: Checking document outlinesI mentioned earlier in the title how the outline algorithm works in HTML5. If you understand the outline algorithm, structuring your page correctly becomes a lot easier. The decision about where to use section content versus flow content and when to use appropriate heading content becomes a lot clearer. Like most things that you do for the first time, this is probably a little easier to grasp if you can visualize the process. So I am going to show you a couple of different ways to make sure that your document conforms to the outline that you are looking for. So I have the trails file that we finished in the last movie which was building headers in HTML5.
Viewers: in countries Watching now:
In HTML5 First Look, author James Williamson introduces the newest HTML specification, providing a high-level overview of HTML5 in its current state, how it differs from HTML 4, the current level of support in various browsers and mobile devices, and how the specification might evolve in the future. Exercise files accompany the course.
- Understanding the history of HTML5
- Using new tags
- Understanding HTML5 semantics
- Coding ID and class attributes in HTML5
- Structuring documents
- Building forms
- Exploring HTML5 native APIs
- Encoding and adding HTML5 video
- Exploring associated technologies such as CSS3
Checking document outlines
I mentioned earlier in the title how the outline algorithm works in HTML5. If you understand the outline algorithm, structuring your page correctly becomes a lot easier. The decision about where to use section content versus flow content and when to use appropriate heading content becomes a lot clearer. Like most things that you do for the first time, this is probably a little easier to grasp if you can visualize the process. So I am going to show you a couple of different ways to make sure that your document conforms to the outline that you are looking for. So I have the trails file that we finished in the last movie which was building headers in HTML5.
If you did not complete that exercise, you can go into the 04_04 folder, open the finished_files directory, and open the trails file from there, it's the same file that I am going to be working with here. So either one is fine. Now, I am going to show you two ways that you can check the document outline. One is a web site that has been specifically built to allow you to parse and check the outline of the document and the other one is a plug-in for Google's Chrome. Now both of those options claim that you can test a page locally from your hard drive and they'll parse it.
But I haven't got either of them to work yet to be quite honest with you when I am testing it locally. So I advise you to go ahead and upload a file to a remote testing server. So if you have access to a remote server, you want to go ahead and upload that file now before we go to our next step. Okay, so I have got Google's Chrome opened and you are going to see that I use a lot of different browsers in this particular title and that's because some browsers have capabilities that others don't. In this case, I am just previewing the page that we are working on in Chrome.
You can see here's our header section, over on this side we have our trail info, and then on the right-hand side we have our aside tag that has the rider reviews and the trail news. And at the bottom of our page, there's a very, very small sort of out of the way footer there. Okay, so cool. So I want to make sure that the document outline and visually it looks fine but I want to make sure that the document outline is what we were expecting. So the first thing I am going to show you guys is a site called the HTML5 Outliner. I am going to go ahead and bring that up, and this is a page that is designed to parse your documents using the HTML5 outline algorithm.
So you are supposed to be able to browse for a file, upload the file, and it'll parse it for you, but honestly, I have never had that work. It always returns some type of an error. However, if you can go ahead and upload a file. In this case, I am going to go ahead and upload this file to our Explore California web site. If you can go ahead and upload that, you can see here, for example, this is trails.htm. If I outline this, it goes ahead and returns the outline for me and it's exactly what we were expecting. The very top element is Explore California Trail Guide and again that's the headline.
Directly underneath that, we have our Main page navigation, and this is why we went ahead and put that h1 tag there because if we hadn't, it would simply say Untitled Navigation. Below that we have Ojai Trails and nested inside that is the individual trail that we are looking at, Northridge Loop. It has two sections, Skill level and Surface. And then finally, here's our aside Trail News. Inside that we have the promotional video for Cycle California and the Rider Reviews. So that was exactly what we were looking for. So the HTML5 Outliner page is a really nice way of checking out one of your pages that you have online to make sure the document structure is producing the proper outline.
I am going to click on the Chrome extension right there, which is going to take me to the Google Chrome extension page. This is the HTML5 Outliner, and you could really just search for that if you wanted to. It's inside the Google.com's Chrome site and I am just going to go ahead and install this. It's going to ask me if I want to install it, I am going to say yes, and now my HTML5 Outliner is now installed. Now, what's really interesting is that from this point on, regardless of whether I am browsing one of my pages or somebody else's, if I am on a page that is using HTML5 document structure, this little icon is going to show up in the upper right-hand corner.
That means that I am going to be able to click on that and find the outline of that document. So if I go to my Explore California Trail Guide page, I don't see the outline there because it's opening up a local resource. So what I am going to do is I am going to type in the direct link to this page that I've uploaded online. So here's that page uploaded online. You can see that's just an image. That asset obviously hasn't been uploaded, neither has this one, but it's really all about the page structure that we are interested in. Again, as I mentioned before, there is our icon in the upper right-hand corner.
If I go ahead and click on that, we can see the exact same outline. So Explore California Trail Guide, Main page navigation, Ojai Trails and all the things nested inside that that we were expecting to see. So there's a couple of different options for you when you are wanting to make sure that the document structure that you are creating is generating the proper outline. Now hopefully, this helps to illustrate why it's so important to understand the new content models and outline algorithm in HTML5. Once you understand those, the mystery of when to use a header, how heading content should be structured, when to use flow content over section markup, all that stuff becomes a lot clearer.
I'd really encourage you to use services like this, like Google Chrome's Outline plug-in or the HTML5 Outline page as you are developing to make sure that the structure of your code matches the desired structure of the content.
There are currently no FAQs about HTML5 First Look.