HTML Lists: Ordered, Unordered, Description Lists, Nesting & Styling – Complete Guide 2025

1. What are the three main types of lists in HTML?

The three main types of lists in HTML are:

2. How do you create an ordered list in HTML? Provide an example.

An ordered list is created using the <ol> tag, with each list item inside an <li> tag.

<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
</ol>
    

3. How do you create an unordered list in HTML? Provide an example.

An unordered list is created using the <ul> tag, with each list item inside an <li> tag.

<ul>
  <li>Apple</li>
  <li>Banana</li>
  <li>Cherry</li>
</ul>
    

4. How can you change the numbering style of an ordered list?

Use the type attribute on the <ol> tag to specify the numbering style. Common values include:

<ol type="A">
  <li>Item One</li>
  <li>Item Two</li>
</ol>
    

5. How do you remove bullets from an unordered list using CSS?

Apply the CSS property list-style-type: none; to the <ul> element.

<style>
ul {
  list-style-type: none;
  padding-left: 0; /* Optional: remove default indentation */
}
</style>
    

6. What is the purpose of the <li> tag in HTML?

The <li> tag defines an individual list item inside ordered (<ol>), unordered (<ul>), or menu lists.

7. Write the HTML code for a description list with two terms and their descriptions.

<dl>
  <dt>HTML</dt>
  <dd>HyperText Markup Language</dd>
  <dt>CSS</dt>
  <dd>Cascading Style Sheets</dd>
</dl>