Monday, 15 July 2013

lists in html

 four types:
  • Unordered or Bulleted lists
  • Ordered or Numbered lists
  • Glossary or Definition Lists
  • Nesting Lists

Unordered or Bulleted lists


<ul> ... </ul> delimits list.
<li> indicates list items. No closing </li> is required.

For Example:
<ul>
<li> apples.                 
<li> bananas.
</ul>

Which looks like this when viewed through a browser:

apples.
bananas.

Ordered or Numbered lists

  • <ul> ... </ul> delimits list.
  • <li> indicates list items. No closing </li> is required.
For Example
<ol>
<li> apples.
<li> bananas.
</ol>
  1. apples.
  2. bananas.    



Glossary or Definition Lists

  • <dl> ... </dl> delimits list.
  • Each list item has two parts: a term and a definition.
  • <dt> indicates the term in the list item, <dd> indicates the definition. No closing </dt>, </dd> is required.
For Example:
<dl>
<dt> apples <dd> A fruit usually green 
and/or red.
<dt> bananas <dd> A yellow fruit.
</dl>
which when viewed in browser looks like:
apples
A fruit usually green and/or red.
bananas
A yellow fruit.




Nesting Lists

Lists of the same or different type may be nested in any number of ways. For Example:
<ul>
<li> Some fruit: 
   <ul>
   <li> bananas.
   </ul>
<li>  Some more fruit 
   <ul>
   <li> oranges.
   </ul>
</ul>
which when viewed in browser looks like:
  • Some fruit:
    • bananas.
  • Some more fruit
    • oranges.










0 comments:

Post a Comment