HTML Lists:

HTML provides three types of lists to organize and structure content on a web page. Lists are essential for presenting information in a clear and hierarchical manner.


The three main types of lists in HTML are:

  1. Unordered Lists (<ul>):
    • Unordered lists are created using the <ul> element.
    • List items within an unordered list are defined with the <li> (list item) element.
    • Unordered lists typically display items with bullet points by default.

    Example:
    <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
     </ul>
    Output:-
    • Item 1
    • Item 2
    • Item 3

  2. Ordered Lists (<ol>):
    • Ordered lists are created using the <ol> element.
    • List items within an ordered list are defined with the <li> element.
    • Ordered lists typically display items with numbers or letters by default.

    Example:
     <ol>
        <li>First Item</li>
        <li>Second Item</li>
        <li>Third Item</li>
    </ol> 
    Output:-
    1. First Item
    2. Second Item
    3. Third Item

  3. Definition Lists (<dl>):
    • Definition lists are created using the <dl> element.
    • Each item in a definition list consists of a term (<dt> - definition term) and its definition (<dd> - definition description).
    • Definition lists are suitable for glossaries or explanations.

    Example:
    <ol>
      <li>First Item</li>
      <li>Second Item</li>
       <li>Third Item</li>
    </ol> 
    Output:-
    1. Item A
    2. Item B
    3. Item C
Additional List Attributes:

  1. type Attribute (for <ol>):
    • The type attribute can be used to specify the type of numbering or bullet points in an ordered list.
    • Values include "1" (numbers), "A" (uppercase letters), "a" (lowercase letters), "I" (uppercase Roman numerals), and "i" (lowercase Roman numerals).
    Example:
    <ol type="A">
     <li>Item A</li>
     <li>Item B</li>
     <li>Item C</li>
    </ol> 
    Output:-
    1. Item A
    2. Item B
    3. Item C

  2. start Attribute (for <ol>):
    • The start attribute specifies the starting value for the numbering in an ordered list.

    Example:
     <ol start="5">
        <li>Item 5</li>
        <li>Item 6</li>
        <li>Item 7</li>
    </ol>
    Output:-
    1. Item 5
    2. Item 6
    3. Item 7

Understanding and utilizing these list types in HTML allows for effective organization and presentation of content, contributing to a well-structured and user-friendly web page.