HTML List

  HTML List

HTML offers web authors three ways for specifying lists of information. All lists must contain one or more list elements. Lists may contain:
<ul> - An unordered list. This will list items using plain bullets.
<ol> - An ordered list. This will use different schemes of numbers to list your items.
<dl> - A definition list. This arranges your items in the same way as they are arranged in a dictionary.

HTML Unordered Lists

An unordered list is a collection of related items that have no special order or sequence. This list is created by using HTML tag. Each item in the list is marked with a bullet.
Eg
<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<ul>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</body>
</html>

This will produce following result:
  • Beetroot
  • Ginger
  • Potato
  • Radish

The type Attribute
 You can use type attribute for tag to specify the type of bullet you like. By default it is a disc. Following are the possible options:
    <ul type="square">
    <ul type="disc">
    <ul type="circle">
    Eg.
    Following is an example where we used <ul type="square"> </ul>


<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<ul type="square">
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</body>
</html>

This will produce following result:
  • Beetroot
  • Ginger
  • Potato
  • Radish

Following is an example where we used <ul type="disc"> </ul>


<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<ul type="disc">
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ul>
</body>
</html>

This will produce following result:
  • Beetroot
  • Ginger
  • Potato
  • Radish


HTML Ordered Lists

If you are required to put your items in a numbered list instead of bulleted then HTML ordered list will be used. This list is created by using <ol> tag. The numbering starts at one and is incremented by one for each successive ordered list element tagged with <li>.

Eg
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<ol>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ol>
</body>
</html>

This will produce following result:
  1. Beetroot
  2. Ginger
  3. Potato
  4. Radish

The type Attribute
You can use type attribute for tag to specify the type of bullet you like. By default it is number. Following are the possible options:

<ul type="1"> - Default-Case Numerals.
<ul type="I">- Upper-Case Numerals.
<ul type="i"> - Lower-Case Numerals.
<ul type="a"> - Lower-Case Letters.
<ul type="A"> - Upper-Case Letters.

Eg. Following is an example where we used <ol type="i"> </ul>


<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<ol type="i">
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
</ol>
</body>
</html>

This will produce following result:
  1. Beetroot
  2. Ginger
  3. Potato
  4. Radish

The start Attribute
You can use start attribute for <ol> tag to specify the starting point of numbering you need. Following are the possible options:

<ol type="1" start="4">    - Numerals starts with 4.
<ol type="I" start="4">    - Numerals starts with IV.
<ol type="i" start="4">    - Numerals starts with iv.
<ol type="a" start="4">    - Letters starts with d.
<ol type="A" start="4">    - Letters starts with D.

<<   Previous Chapter   >>                     <<   Next Chapter   >>


No comments:

Post a Comment