Start learning with our library of video tutorials taught by experts. Get started

HTML5: Structure, Syntax, and Semantics

Creating document sections


From:

HTML5: Structure, Syntax, and Semantics

with James Williamson

Video: Creating document sections

There are two things that can create sections within your document: sectioning content--such as the section, article, and nav elements--and headings. In this movie, I want to start the process with illustrating the HTML5 outline algorithm by using a tool that I suspect you're going to be using a good bit as you begin to author HTML5 documents. This is the HTML5 Outliner, and you can find it gsnedders.html5.org/outliner. It's a neat little slice of JavaScript, created by Jeffrey Sneddon--and Jeffrey, I hope I pronounced your name right; I am sorry if I didn't-- that allows authors to visualize the outline generated by their HTML5 file.
Expand all | Collapse all
  1. 2m 20s
    1. Welcome
      48s
    2. Using the exercise files
      1m 32s
  2. 19m 7s
    1. A brief overview of HTML5
      3m 57s
    2. What's in the HTML5 specification?
      8m 17s
    3. Why do we need new structural elements?
      6m 53s
  3. 50m 33s
    1. Defining HTML5 documents
      5m 5s
    2. HTML5 syntax
      9m 14s
    3. The header element
      5m 22s
    4. The nav element
      4m 55s
    5. The section element
      4m 51s
    6. The article element
      4m 48s
    7. The aside element
      4m 13s
    8. The footer element
      4m 17s
    9. Content model overview
      7m 48s
  4. 35m 28s
    1. Understanding the outline algorithm
      3m 17s
    2. Creating document sections
      8m 25s
    3. Using headings properly
      9m 1s
    4. Using hgroup to override sectioning
      4m 17s
    5. Properly nesting structure
      7m 17s
    6. Sectioning roots
      3m 11s
  5. 58m 30s
    1. Organizing content
      4m 41s
    2. Planning document structure
      5m 47s
    3. Choosing the right structural element
      4m 43s
    4. Checking document outlines
      5m 27s
    5. Coding initial page structure
      5m 28s
    6. Using class and ID attributes
      5m 31s
    7. Structuring headers
      13m 13s
    8. Building navigation
      7m 1s
    9. Structuring footers
      6m 39s
  6. 1h 27m
    1. Working with figure and figcaption
      7m 12s
    2. Grouping content with asides
      3m 46s
    3. Using divs in HTML5
      5m 0s
    4. Working with lists in HTML5
      7m 10s
    5. The return of bold and italic
      5m 52s
    6. Citing works semantically
      6m 32s
    7. Using the address element
      5m 24s
    8. Using the small element
      4m 24s
    9. Using the mark element
      5m 16s
    10. Working with date and time
      11m 55s
    11. Creating block-level links
      8m 53s
    12. Understanding link relationships
      9m 28s
    13. Defining link relationships
      6m 23s
  7. 17m 22s
    1. Current browser support
      7m 38s
    2. Ensuring block-level display
      4m 3s
    3. Adding support for elements in older browsers
      5m 41s
  8. 3m 46s
    1. Additional Resources
      3m 46s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
HTML5: Structure, Syntax, and Semantics
4h 34m Beginner May 31, 2011

Viewers: in countries Watching now:

Gain a deeper understanding of HTML5 and learn how to create richer, more meaningful web pages with structural tags and descriptive attributes. In this course, author James Williamson presents an overview of HTML5 and its development, defines the new tags and attributes, and discusses how browsers parse and display HTML5 content. The course also includes step-by-step instructions for constructing an HTML5 document with a header and footer, navigation, content groups, and formatting.

Topics include:
  • Defining basic elements
  • Exploring the content model
  • Creating document sections
  • Using hgroup to override sectioning
  • Using the proper nesting structure
  • Choosing the right structural element
  • Using class and ID attributes
  • Building navigation
  • Grouping content with asides
  • Using divs in HTML5
  • Creating block level links
  • Defining link relationships
  • Understanding current browser support
  • Adding support for elements in older browsers
Subjects:
Developer Web Web Design Web Foundations Programming Languages Web Development
Software:
HTML
Author:
James Williamson

Creating document sections

There are two things that can create sections within your document: sectioning content--such as the section, article, and nav elements--and headings. In this movie, I want to start the process with illustrating the HTML5 outline algorithm by using a tool that I suspect you're going to be using a good bit as you begin to author HTML5 documents. This is the HTML5 Outliner, and you can find it gsnedders.html5.org/outliner. It's a neat little slice of JavaScript, created by Jeffrey Sneddon--and Jeffrey, I hope I pronounced your name right; I am sorry if I didn't-- that allows authors to visualize the outline generated by their HTML5 file.

Now as you can see, you can upload a local HTML file, you can input a valid URL, or you can enter code directly into this sample section. Now, I am going to show you guys the other ways to check the generated outlines of your pages a little bit later on, but for right now, the HTML5 outliner is perfect for what we want to do. Before we do this, I want to make a quick point. This chapter is admittedly going to be a bit of a technical exercise. At the end of it, you might say to yourself, yeah okay, but why do I need to pay so much attention to all this? If you are using proper semantic tags to identify content, and it looks okay in the browser, what's the issue, right? Well, that would be true if just humans read your site.

However, the fact is that automatic outline generation is very important for search engines, assistive technologies, syndication, readers, and other web crawlers. If you have a poorly formed document, your table of contents will be confusing, search engines won't be able to properly rank page data, and navigation through assistive technologies can be hampered. Trust me, it is worth putting in the time to learn this. Now, the first thing I want to do is show you exactly how individual sections are created, so what we are going to do is we're just going to type our HTML directly into the outliner itself.

So the first thing I am going to do is just go ahead and get rid of everything but the doctype and the title. Now, we don't even really need those. It will work with snippets, but it'll give us a nice sort of grounding, a base if you will. So the first thing I am going to do is just type in a section element directly in there, and there is nowhere to save it. I just want to outline it. Now when I do that, it looks like something weird has happened, right? Now the section element is supposed to create a single section in your document, but here we see we have an untitled section in an untitled section.

Now, that seems kind of odd, until you realize that the body tag itself is a sectioning element. So what we are really seeing here is we are seeing the body tag as untitled, and then we are seeing our initial section element as well. All right, let's go back a little bit and let's take advantage of those tags we learned earlier to create four individual sections. So I am going to start with a nav, and then I'll close my nav tag there. Next, I'll do section, close section, and we just had one. Then I'll do article, close article, and then finally, I am going to do an aside here.

Okay. I'll go ahead and outline that, and notice that inside of our body tag, we now have four beautiful untitled sections. Untitled sections can be really, really confusing for table of contents and in generating these outlines, so one of the first things I want to mention here about sectioning content is that when you have a heading inside sectioning content, the initial heading that comes in contact with, the very first one, is used to title the section and not create its own unique section.

So let me go back a little bit, and I am going to modify this. Just in front of my nav element, for example, I am going to add an h1 tag and I am just going to say "Explore California" inside the h1 tag. There we go. And then I am going to go into all my sections and give them headings as well. Inside the nav section, for example, I am going to do an h2 tag. And again, one of the things that is really interesting about this--and this is going to say, "site navigation"--is that the way that we do headings now in HTML5, we have got a lot more latitude.

In the past, you have really only wanted one h1 per page, that sort of thing, and then you used sort of hierarchy of headings as you go down through the page. Now each section has its own sort of internal hierarchy, so I could have very easily use an h1 here, and still been in conformance. Not very many people are adopting that yet, because some of the search engines do penalize for things like that, so it's still evolving, but I just want to let you know that you are able to do that. So again, I will do another h2 inside of my section here. This section is going to say, "Our Tours." I am going to close that.

Let's go down to article again, and inside of article, we'll have another h2 tag. This will say, "Tour Reviews." Close that. And then finally, in our aside here, I am going to do another h2 and I am just going to say, "Monthly Specials." Okay, cool! All right, so now I am going to go ahead and outline that. And now instead of seeing untitled section, now this document is starting to make sense.

So we have Explore California, and inside that we have our Site Navigation, Our Tours, Tour Reviews, and Monthly Specials. And I think you can start to see a reason to embrace this. We are seeing a very clear structure in our document just by using the proper elements in and titling them correctly. I am going to go back, and the last thing I want to do here before we move on to our next exercise, let's talk about nesting elements inside of other elements. So, nesting elements just provides a more complex structure. So, for example, if I were to go into the Our Tours section here--and I am just going to hit Return a few times to create some empty space here--and inside this, for example, maybe I was interested in putting an article in here, so I am just going to do another article tag.

So I am creating a nested article inside of the Our Tours section, and the first thing I am going to do here is do an h2. So I am sort of establishing the hierarchy of the initial header of every section is going to be an h2 and then I would nest from there. So this is going to be Cycle California, and I will close the h2 tag. I'm going to keep the article open for just a moment here. Inside this article, I'm going to nest another section, and in this section, this time since it's nested further, I will use an h3. And here I am going to do Trail Reviews, so maybe there are some trail reviews available for the Cycle California tour.

Okay, at this point, I am going to close the section, and then I am going to go ahead and close the article as well. So let's take a look at what that does for us, as you can see that now we have this nested document outline. Inside Our Tours, we have our first tour, which is Cycle California, and inside that, it contains some trail reviews, and you can see in sort of how it's nested. It's really easy sometimes to forget or mix up which elements actually create sections. For example, the div tag, the div tag is used so frequently to create sections in previous versions of HTML, it seems like a natural choice for creating sections here, except that it doesn't, not in HTML5 anyway.

Let me show you what I mean. I am going to into the code here and inside our Tour Review articles, I am just going to create a new line. And inside that, I am going to go ahead and create a div tag, and we'll just use an h3 since we are nesting inside this article. So we are just going to do an h3 here, and inside this h3, since this is Tour Reviews, why don't we go ahead and review the Backpack California tour? And so then I will close the h3, and then I will close the div tag. Now remember, div tags don't create sections, right? So if I outline this, it sure does look like they create sections because there is a new section right there, Backpack California.

So do div tags create sections or don't they? Well, it's very easy to be confused by this, so let me show you. If we go back into our code and we replace the h3 with a paragraph tag-- so inside the div tag I am going to replace that h3 with a paragraph tag and outline it-- we can see that that now goes away. So we know, in that case, it wasn't the div tag that was creating the section; it was the heading tag, the h3 tag. The div tag is not sectioning content and will not create a new section. It's really easy to get confused about that.

So just remember that as far as headings go, when they are not the first heading element in the section, they are going to create their own implicit section. That, and the fact that the rules for using heading levels have changed a little bit in HTML5, means the headings really deserve their own discussion, and we are going to go ahead and dive into that discussion next.

There are currently no FAQs about HTML5: Structure, Syntax, and Semantics.

Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed HTML5: Structure, Syntax, and Semantics.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked