HTML lists: what's new in HTML 5?

There is a big and justified interest from the web community about the changes introduced in HTML 5 and in the last weeks I'm frequently receiving a lot of questions and requests about this topic. In this post I want to illustrate a quick roundup of some point of interest about the use of lists in HTML 5.
How you know HTML has three types of lists:

-

    , unordered list-
      , ordered list-
      , definition listThe HTML
    1. tag defines a list item and is used in both
        and
          lists.
          and
          tags define a definition term and the related description in a definition list. These tags are all supported in HTML 5 version but there are some little changes in their attributes, in particular:

    and
      the attribute compact and type are not longer supported in HTML 5 (you have to use CSS instead).

    1. the attribute type, which specifies the type of the list, is not longer supported in HTML 5 (you have to use CSS instead).
      The attribute value, which defines the value of the first item of the list, is not longer deprecated and can be only used with the
        tag.


Unordered list for navigation bar
Another lists-related question is about the structure of the navigation bar of a website with the introduction of the new tag in HTML 5. How you know, unordered lists are commonly used to implement the navigation bar of a website. The typical structure of a navigation bar is a
tag that contains an unordered list with some items:


Here is the HTML code to implement the basic structure of a navigation bar


In HTML 5, the structure of a navigation bar is the same illustrated in the previous code. The only thing that changes is the the external "container" of the unordered list. You have to use the new instead a generic
tag



Definition list and the tag
Definition lists are not frequently used in web design end a lot of people even ignore their existence! In general their use is mainly suggested when you have to represent a list of items with a related description for each item of the list. Here is the code that describes a generic definition list:


Google
Search engine
Facebook
Social network

Here is the output in a web browser:

Google
Search engine
Facebook
Social network


HTML 5 introduces the new tag that uses

and
tags (these tag are used to define a term and its description in a definition list) to describe a conversation. Here is an example of dialog structure
Anna
What time is it?
Mark
Three o'clock
Anna
Thanks!
And here is the output in a web browser:
Anna
What time is it?
Mark
Three o'clock
Anna
Thanks!
*NOTE: the tag has been dropped in HTML revision 3859 (2009-09-15). Thanks to Dylan for the suggestion. The new
and
tags now use
and
instead of .That's all. If you have some suggestion about this topic, please leave a comment. Thanks!

0 comments:

Recent Comments