HTML Lists

HTML (Hypertext Markup Language) provides a way to create lists on a webpage. There are three types of lists in HTML: ordered lists, unordered lists, and definition lists.

  1. Ordered Lists

Ordered lists are used to present information in a specific order. They are created using the <ol> tag and each item in the list is enclosed in an <li> tag. The list items are numbered by default, but this can be changed using CSS.

Example:

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>
  1. Unordered Lists

Unordered lists are used to present information in an unordered fashion. They are created using the <ul> tag and each item in the list is enclosed in an <li> tag. The list items are typically bulleted by default, but this can be changed using CSS.

Example:

<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ul>
  1. Definition Lists

Definition lists are used to present a set of terms and their definitions. They are created using the <dl> tag, with each term enclosed in a <dt> tag and its definition enclosed in a <dd> tag.

Example:

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

Lists can be nested within each other to create more complex structures. For example, an ordered list can contain an unordered list and vice versa.

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *