HTML List

In HTML, a list is a way of displaying a group of related items in an ordered or unordered manner. There are three types of lists in HTML: unordered lists (<ul>), ordered lists (<ol>), and definition lists (<dl>).

  1. Unordered Lists (<ul>)
  2. An unordered list is a list of items that are displayed with bullet points. To create an unordered list, you use the <ul> tag, and for each item in the list, you use the <li> tag. Here's an example:

    <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    </ul>

    In this example, we have created an unordered list with three items.

  3. Ordered Lists (<ol>)
  4. An ordered list is a list of items that are displayed with a numbered or lettered sequence. To create an ordered list, you use the <ol> tag, and for each item in the list, you use the <li> tag.Here's an example:

    <ol>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
    </ol>

    In this example, we have created an ordered list with three items.

  5. Definition Lists (<dl>)
  6. A definition list is a list of terms and their definitions. To create a definition list, you use the <dl> tag, and for each term and definition pair, you use the <dt> and <dd> tags, respectively. Here's an 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>

In this example, we have created a definition list with three terms and their respective definitions.

You can use these list types to organize and present information in a way that is easy to read and understand for your users. Additionally, you can use CSS to style the lists, such as changing the bullet or numbering styles, adding padding or margins, and more.

Next Article ❯