Home

How to Create an Unordered List for HTML5 and CSS3 Programming

|
|  Updated:  
2016-03-26 13:18:07
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon

All the list types in HTML5 are closely related. The simplest and most common kind of list is an unordered list. You can also use ordered lists and nested lists in HTML.

Look at an unordered list

Look at the simple page. In addition to a couple of headers, it has a list of information.

This list of browsers has some interesting visual characteristics:

  • The items are indented. There's some extra space between the left margin and the beginning of each list item.

  • The list elements have bullets. That little dot in front of each item is a bullet. Bullets are commonly used in unordered lists like this one.

    image0.jpg
  • Each item begins a new line. When a list item is displayed, it's shown on a new line.

These characteristics help you see that you have a list, but they're just default behaviors. Defining something as a list doesn't force it to look a particular way; the defaults just help you see that these items are indeed part of a list.

Remember the core idea of HTML here. You aren't really describing how things look, but what they mean. You can change the appearance later when you figure out CSS, so don't get too tied up in the particular appearance of things. For now, just recognize that HTML can build lists, and make sure you know how to use the various types.

How to build an unordered list

Lists are made with two kinds of tags. One tag surrounds the entire list and indicates the general type of list. This first example demonstrates an unordered list, which is surrounded by the pair.

Note: Indenting all the code inside the

    set is common. The unordered list can go in the main body.

    Inside the

      set is a number of list items. Each element of the list is stored between a
    • (list item) and a tag. Normally, each
    • pair goes on its own line of the source code, although you can make a list item as long as you want.

      You can change the bullet to all kinds of other images, including circles, squares, and even custom images.

      The code for the unordered list is pretty straightforward:

      <!doctype html>
      <html lang="en">
      <head>
       <meta charset="UTF-8">
       <title>basicUL.html</title>
      </head>
      <body>
       <h1>Basic Lists</h1>
       <h2 id="tab3" >Common web Browsers</h2>
       <ul>
        <li>Firefox</li>
        <li>Chrome</li>
        <li>Internet Explorer</li>
        <li>Opera</li>
        <li>Safari</li>
       </ul>
      </body>
      </html>

      About This Article

      This article is from the book: 

      About the book author:

      Andy Harris earned a degree in Special Education from Indiana University/Purdue University–Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
      Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
      Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
      Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
      Andy welcomes comments and suggestions about his books. He can be reached at [email protected].