HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

HTML Lists

In HTML, lists are used to organize and structure content in a specific order. There are three main types of lists: ordered lists, unordered lists, and definition lists.

Ordered Lists (<ol>):

  • Ordered lists are used when the sequence of items matters, and each item is numbered.
  • Items within an ordered list are represented by the <li> (list item) element.

Example

<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
You can click on above box to edit the code and run again.

Output

  1. First item
  2. Second item
  3. Third item

Unordered Lists (<ul>):

  • Unordered lists are used when the sequence of items doesn't matter, and each item is typically preceded by a bullet point
  • Items within an unordered list are also represented by the <li> element.

Example

<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
You can click on above box to edit the code and run again.

Output

  • First item
  • Second item
  • Third item

Definition Lists (<dl>):

  • Definition lists are used to define terms and provide their corresponding definitions.
  • They consist of terms (<dt> - definition term) and their definitions (<dd> - definition description).

Example



<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
<dt>Term 2</dt>
<dd>Definition 2</dd>
</dl>

You can click on above box to edit the code and run again.

Output

  Term 1
Definition 1
Term 2
Definition 2