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

HTML5: Structure, Syntax, and Semantics

Working with lists in HTML5


From:

HTML5: Structure, Syntax, and Semantics

with James Williamson

Video: Working with lists in HTML5

We're going to take a slight break from our Trails page for just a moment to talk about lists. Now if you've been authoring web pages for any time at all, you're probably pretty familiar with at least two types of the lists available to you in HTML. I mean most web authors, for example, have used an unordered list or an ordered list probably pretty frequently, and they're especially handy, for example, when you create navigation. Now for the most part, lists remain unchanged from HTML 4 to HTML5; however, the ordered list and the definition list have changed a little bit, so I want to discuss those changes and maybe experiment a little with what we can do with definition lists in HTML5.
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

Working with lists in HTML5

We're going to take a slight break from our Trails page for just a moment to talk about lists. Now if you've been authoring web pages for any time at all, you're probably pretty familiar with at least two types of the lists available to you in HTML. I mean most web authors, for example, have used an unordered list or an ordered list probably pretty frequently, and they're especially handy, for example, when you create navigation. Now for the most part, lists remain unchanged from HTML 4 to HTML5; however, the ordered list and the definition list have changed a little bit, so I want to discuss those changes and maybe experiment a little with what we can do with definition lists in HTML5.

So first things first. I want to go to the specification. I'm here in the author view and I've navigated to the ordered list element. Now, I want to point out just a couple of really minor changes, but they are changes that could have a big effect on you. Now first off, the start attribute right here, which was actually deprecated in XHTML, is back. Now what this does is it allows you to change the value of where the list begins its count. So this is good, since most browsers never really stop supporting it anyway. So feel free to go back and use it if you want.

Now let me go back for just a second. They've also added a brand-new attribute, which is reversed. And what's really neat about reversed, this is a Boolean value, meaning you can just say reversed on the list, and if it's found, it's true. Now this allows you to create a list that basically counts backwards. That's really cool, but unfortunately, as of yet, nobody's gotten around to supporting it. But once they do start supporting it, it's going to be a neat capability to have. As for the definition list, a little bit of clarity has been added. Now previously, in HTML 4, a definition list was defined as a list containing a term and one or more definitions for that term.

Now, this didn't really reflect how authors were using the definition list, as people were using it for things like bibliographies, indexes, and really all sorts of non-definition list lists. So now, let's take a look at what the definition reads, and I am just going to scroll down a little bit. So here we have, "The dl element represents an association list consisting of zero or more name-value groups." And if we go down a little bit further, "Name-value groups may be terms and definitions, metadata topics and values, questions and answers, or any other groups of name-value data." All right! So that means as long as there's a clear relationship between the name-value pairs, almost anything can be described by a definition list.

And honestly, that's really simply bringing the specification up and recognizing how authors were using the definition list in the real world anyway. Okay, so what we're going to do is we're going to go back into one of our pages and take a look at how we might use it. Okay, so I've opened up the all_trails.htm. So we're working on sort of a new file here, and you can find this in the 05_04 folder. Now, I want to scroll down a little bit, and I can see that what we're basically looking at now is a list of all of our trail reviews.

So if you think about the way our Trail Review page functions, obviously, we're looking at a specific article normally, but this time we're looking at all of the trails that have reviews available to them. So after the header content, we have an

tag that says All Trails, and then we have a listing of all the individual trails and then links to those trails. Okay, so this type of structural content where you have kind of a heading and then individual items within that heading, that is a perfect structure for what definition lists allow us to do now in HTML5.

So that's exactly what we're going to do here. We're going to structure these links in definition lists rather than an ordered or unordered list because the structure just lends itself to that a little bit better. All right! So I'm going to go ahead and create a definition list right above the first element, and I'm going to go all the way down to our last one and close out the definition list. So the

tag is the opening definition list tag. Now after that, we have two tags to choose from: a
which is the term, and a
which is the definition.

So essentially, those are your name- value pairs, and the term typically comes first and the definition typically comes after that. And you can have as many definitions within a term as you want. So, the way that we're going to be using this is that each of the areas is going to be a term, and then the individual reviews inside of that will be a definition. So I'm going to highlight Butte. I'm just going to wrap that in a

tag, and then each of the individual trail reviews inside of that are going to get the
tags. Perfect! So those are going to be the definitions. So I'm just going to go ahead and do that all the way through.

Now while we're doing this, it gives us a good opportunity to talk about different structures and different cases where a definition list would be pretty helpful. Now I mentioned earlier before that a lot of people use them for things like bibliographies. I've seen people use them for comments in blogs. So you might have a threaded comment section where you have the definition term being the opening comment and then the definitions inside of those being the actual comments themselves. So really, any structure where you have sort of this repeating structure is a good case use for a definition list.

You have those name-value pairs, and remember, the inside of the name-value pairs can be anything that you want them to be. You're not limited to links or paragraphs or just text. You can have images. I've seen people do images inside of them. You can really do anything you want with them. Now, to avoid you having to watch me do all this, what we're going to do is I'm just going to skip to having these all done. If you want, you can just pause the video and then finish this structure up and then un-pause it when you're done, and we'll pick back up from there. All right! So I'm just finishing up my last one here. There we go.

You can see, I know there's a lot of them, but we've got a lot of tour reviews, don't we? So you can see the structure of this, individual definition terms for the regions themselves, and then the definitions inside of them are the actual tour reviews. So if I save this and test it in the browser, we can kind of see our structure. I styled through CSS, and these are all links to our trails. So I think it's easy to see that in certain instances, the structure that the definition list, and really all the other lists in HTML5 afford you, allow you to structure your content in a more meaningful way.

So we didn't have to use a table here. We didn't have to use headings and paragraphs. We were able to use the definition list, which group all these links together, lets people know that they are related, they do belong together, and yet we still get the advantage of using the name- value pairs that the definition list gives us. So the changes that were made in the specification to both the ordered list and the definition list are minor on the face of them. But especially the changes to the definition list are going to allow authors to continue using them as they have in the past, with really a clear conscience about being in conformance with the specification.

Now the tweaks they made to the order list are going to be helpful as well, especially once the reversed attribute is supported.

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