Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We are almost done with exploring how HTML5 documents are structured. Now so far, we've covered the outline algorithm, HTML5's four sectional elements, and how headings can be used to title sections and create implicit sections of their own. Now there is, however, one last sectioning element left to discuss, and that is sectioning roots. Sectioning roots contain their own internal outline, but that outline, no matter how complex it is, is not added to any ancestor or parent element's outline.
Now essentially, the contents of section roots are hidden from the rest of its parent's element's outline. Now, sectioning root elements are blockquote, details, fieldset, figure, and td, or table depth. Now, the body element is also considered a sectioning root, which could be extremely important if you're merging page content together from multiple pages. So let's take a look at how they work. So here I am again in the HTML5 Outliner, and again, I have saved you the torture of watching me type code. So if you want to do this along with me, once again go ahead and pause your video, go ahead and enter in the code you see here, and start it back when you are done.
Okay, so examining the structure of what we have here inside our Explore California page, we have a single article, and that article contains the Cycle California bike reviews. In addition to the article text, we have two bikes that we are reviewing currently: the Haro Flightline Comp and the Giant Talon. And we also have this other heading right here that says, "This bike is totally rad!! At least that's what everyone says." Now obviously that's a quote where somebody is talking about the Haro Flightline Comp bike, but if we outline this, we can see that that quote is added to the outline.
Now, the obvious solution for that, don't use a heading. But what if you did want to structure it that way? You're certainly within your own rights to do that. Well, remember our sectioning root tags. Remember our sectioning root elements. So this is actually perfect for a blockquote. So what I am going to do is go in and I am going to wrap that heading 3 tag in a blockquote element. And again, I am going to grab the paragraph as well because that's part of the quote, and then we'll go ahead and finish that up. So we're essentially wrapping the quote, which again is with the heading 3 tag on the paragraph as well.
Now when I outline this, as if by magic, it goes away. Now, it's being hidden from the document structure because it's in the blockquote tag, and that essentially means that blockquote has its own internal structure that isn't added to the parent outline. So it has its own outline, and if we could target just that particular element, you would physically see that outline. Now keep in mind that the purpose of these sectioning root elements isn't simply to hide things from the document outline. It is a nice byproduct. It's nice it is working for us. But if you think about which of those elements are sectioning roots, like the blockquote, body, details, fieldset, figure, and td, you know, it simply makes sense to separate their internal outline from any preceding parent outline.
Now, those elements feature content that's self-contained and whose internal structure could really be harmful to the understanding of the overall document outline of who's added to it. So I think it's important to understand how these sectioning roots function, so that when you're planning your document structure, you don't have any nasty surprises a little bit later on when your outlines are generated.
Get unlimited access to all courses for just $25/month.Become a member