Page 24 - HTML5 Notes for Professionals
P. 24

<ul>
         <li>Item</li>
         <li>Another Item</li>
         <li>Yet Another Item</li>
       </ul>


       This will produce a bulleted list (which is the default style):


                 Item
                 Another Item
                 Yet Another Item




           You should use ul to display a list of items, where the order of the items is not important. If changing the
           order of the items makes the list incorrect, you should use <ol>.



       Section 7.3: Nested lists


       You can nest lists to represent sub-items of a list item.


       <ul>
         <li>item 1</li>
         <li>item 2
           <ul>
             <li>sub-item 2.1</li>
             <li>sub-item 2.2</li>
           </ul>
         </li>
         <li>item 3</li>
       </ul>


                 item 1
                 item 2
                       sub-item 2.1
                       sub-item 2.2
                 item 3


       The nested list has to be a child of the li element.

       You can nest different types of list, too:


       <ol>
           <li>Hello, list!</li>
           <li>
               <ul>
                   <li>Hello, nested list!</li>
               </ul>
           </li>
       </ol>

       Section 7.4: Description List


       A description list (or definition list, as it was called before HTML5) can be created with the dl element. It consists of


       GoalKicker.com – HTML5 Notes for Professionals                                                           17
   19   20   21   22   23   24   25   26   27   28   29