Pages

HTML List Tags

Lists are used in HTML to order data in groups . A list can be links or just text .There are three different kinds of lists in HTML : ordered, unordered, and definition lists.


Ordered lists <ol>
are prefixed by numbers .

unordered lists <ul> are prefixed by bullets .

Definition lists <dl> are not prefixed by anything .


Suppose we have to create an unordered list of :

   Memento
   The Dark Knight
   The Fountain
   Blade Runner

We do it as

     <ul>
       <li>Memento</li>
       <li>The Dark Knight</li>
       <li>The Fountain</li>
       <li>Blade Runner</li>
     </ul>



Lists can also be nested inside each other as :

    <ul>
       <li>
         <ul>Movies
            <li>Memento</li>
            <li>The Dark Knight</li>
            <li>The Fountain</li>
            <li>Blade Runner</li>
         </ul>
        </li>

       <li>Books
         <ul>
           <li>The Idiot</li>
           <li>Walden</li>
           <li>Roots and Wings</li>
         </ul>
       </li>
     </ul>




Definition lists

There are two elements in definition lists <dt> and <dd> .

<dt> - definition’s title

<dd> - definition’s description

e.g.

    <dl>
      <dt>xyz</dt>
      <dd>description of xyz</dd>
    </dl>

xyz can be glossary terms, titles etc.