HTML - Lists

HTML Lists

HTML lists are used to group connected information (items, names, etc) in a particular way. The three (3) types of lists in HTML are: Ordered, Unordered and Description lists.

Ordered Lists

Ordered lists are used to group connected information in a particular order.

  • Entire lists are enclosed inside <ol>.....</ol> tags
  • Individual list item is enclosed inside <li>.....</li> tags.
  • There are five (5) ordered list type: numbers (1, 2), capital letters (A, B), small letters (a, b), capital roman numerals (i, ii) and small roman numerals (I, II).
  • <ol> accepts type attribute which is used to specify the list type. Example: type="A"

DEFAULT (NUMBERS)

The default list type for ordered list is numbers; whether you specify the attribute type="1" inside the opening <ol> tag or not.

CAPITAL LETTERS

The attribute type="A" is written inside the opening <ol> tag.

SMALL LETTERS

The attribute type="a" is written inside the opening <ol> tag.

CAPITAL ROMAN NUMERALS

The attribute type="I" is written inside the opening <ol> tag.

SMALL ROMAN NUMERALS

The attribute type="i" is written inside the opening <ol> tag.

tips
TIP:

List type can be specified using any of the CSS styling methods. The property for styling this is list-style-type.


Unordered Lists

Unordered lists are used to group connected information in no particular order.

  • Entire lists are enclosed inside <ul>.....</ul> tags
  • Individual list item is enclosed inside <li>.....</li> tags.
  • There are five (3) unordered list type: disc, square and circle.
  • <ul> accepts type attribute which is used to specify the list type. Example: type="disc"

DEFAULT (DISC)

The default list type for unordered list is disc; whether you specify the attribute type="disc" inside the opening <ol> tag or not.

SQUARE

The attribute type="square" is written inside the opening <ul> tag.

CIRCLE

The attribute type="circle" is written inside the opening <ul> tag.

Description Lists

Description lists are used to group connected information and their descriptions.

  • Entire lists are enclosed inside <dl>.....</dl> tags
  • Description term for the list item is enclosed inside <dt>.....</dt> tags.
  • Description list are enclosed inside <dl>.....</dl> tags.
note
NOTE:

These lists can also be called:
Ordered lists - Numbered lists
Unordered lists - Bulleted lists
Description lists - Definition lists


Nested Lists

Nested list is a list inside another list.

ADVERTISEMENTS

LEARNING IS A CONTINOUS PROCESS - PRACTICE MAKES PERFECT