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>
    

Frequently asked questions

What are the three main types of lists in HTML?

Ordered lists (<ol>) for numbered items, unordered lists (<ul>) for bullet points, and description lists (<dl>) for terms and descriptions.

How do you create an ordered list in HTML?

Use the <ol> tag with <li> items inside. Numbers are automatically added.

How do you create an unordered list in HTML?

Use the <ul> tag with <li> items inside. Bullet points are displayed by default.

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

Use the type attribute on <ol>: type="A" (uppercase letters), type="a" (lowercase), type="I" (Roman numerals), etc. Modern best practice: use CSS list-style-type instead.

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

Apply list-style-type: none; and optionally padding-left: 0; to the <ul>.

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

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

How do you create a description list in HTML?

Use <dl> with <dt> for the term and <dd> for its description.