Lists

Ordered List :

  • If you want to display the list of items with numbering ,then using <ol> tag , it is a ordered list.
  • It have type attribute which tell its number or capital letters or roman letters etc.,

-<ol> defines list as ordered list

-<li> defines each item in the list

Attributes :

Type

Default type is normal Arabic numerals

TYPE = 1 | A | a | I | i

Start

Default start attribute have value 1

you may change the value of the start attribute.

Example :

An Ordered List:

  1. Coffee
  2. Tea
  3. Milk
<h4>An Ordered List:</h4>
<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ol>

UnOrdered List :

Unordered list is used to display the list of items is unordered list.

-<ul> defines list as unordered list

-<li> defines each item in the list

Attributes

Type

Default type is circle

TYPE = DISC | CIRCLE | SQUARE

Example:

  • coffee
  • tea
  • lemonade

code:

<UL TYPE=SQUARE>
<LI>coffee
<LI>tea
<LI>lemonade
</UL>

Definition List :

The <dl> tag defines a definition list.

The <dl> tag is used in conjunction with <dt> (defines the item in the list) and <dd> (describes the item in the list).

Example:

A Definition List:

Coffee
Black hot drink
Milk
White cold drink

code

<dl dir=ltr>
  <dt>Coffee</dt>
  <dd>Black hot drink</dd>
  <dt>Milk</dt>
  <dd>White cold drink</dd>
</dl>

source : w3schools

Posted in Html