List in HTML

Lits and Its Types in HTML

In html we display the information in shape of list for example if we want to display the name of subject:

1 Math

2 Computer

3 English

HTML offers several mechanisms for specifying lists of information. All lists must contain one or more list elements. Lists may contain:

Unordered List.

Ordered List.

Definitions List.

HTML Unordered Lists

An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. An unordered list typically created with bulleted. You can also customize the bullets and to wrap list items horizontally or vertically for multicolumn lists.

The opening list tag must be <UL>. It is followed by an optional list header (<LH>caption</LH>) and then by the first list item (<LI>). For example:


<ul>
<lh>Subject Name</lh>
<li>Math</li>
<li>Computer</li>
<li>English</li>
</ul>

which could be rendered as:

Subject Name

  • Math
  • Computer
  • English

We can also pass argument for example
 <ol type=" disc | square | circle ">

Note : - The "type" attributes are not supported in HTML5.


<ul type="square">
<li> Math</li>
<li> Computer</li>
<li> english</li>
</ul>
<ul type="disc">
<li> Math</li>
<li> Computer</li>
<li> english</li>
</ul>
<ul type="circle">
<li> Math</li>
<li> Computer</li>
<li> english</li>
</ul>

This could be rendered as:

  • Math
  • Computer
  • english

  • Math
  • Computer
  • english

  • Math
  • Computer
  • english

HTML Ordered List

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.

The list items are marked with numbers.


<ol>
<li>Math</li>
<li>Computer</li>
<li>English</li>
</ol>

The above code display the follwoing Result:

  1. Math
  2. Computer
  3. English

We can also pass argument for example

<ol type="1|a|A|i|I">

html definition term lists

HTML definition lists display the terms and there definition. The definition list created with <dl> tag.

<dl> - This is start of List
<dt> - Definition term
<dd> - Definition of the list item

You can bold the list item with <b> tag.

Example of HTML Definition List


<dl>
<dt><b>CPU</b></dt>
<dd>Centeral Processing Unit.</dd>
<dt><b>IT</b></dt>
<dd>Information Technology.</dd>
</dt>
</dl>

The result of above code is:

CPU
Centeral Processing Unit.
IT
Information Technology.