Lists

In HTML 3 type of list:

  • <ul> - unordered list
  • <ol> - ordered list
  • <dl> - description list

Nested lists allowed.

You can use the list-style css property to style the list.

Unordered list

The <ul>element defines a unordered list. The <li> element defines a list item.

The type attribute of the <ul> element defines the list item marker:

  • disc sets the list item marker to a bullet (default)
  • circle sets the list item marker to a circle
  • square sets the list item marker to a square
  • none the list items will not be marked
coderesult
<ul>
<li>list item 1</li>
<li>list item 2</li>
  <ul>
       <li>sub list item 1</li>
       <li>sub list item 2</li>
   </ul>
</ul>

<ul type="circle">
<li>list item 1</li>
<li>list item 2</li>
</ul>
  • list item 1
  • list item 2
    • sub list item 1
    • sub list item 2
  • list item 1
  • list item 2

Ordered list

The <ol>element defines a ordered list. The <li> element defines a list item.

The type attribute of the ol element defines the list item marker:

  • 1 numbered with numbers (default)
  • A numbered with uppercase letters
  • a numbered with lowercase letters
  • I numbered with uppercase roman numbers
  • i numbered with lowercase roman numbers
exampleresult
<ol>
<li>list item 1</li>
<li>list item 2</li>
  <ol>
       <li>sub list item 1</li>
       <li>sub list item 2</li>
   </ol>
</ol>

<ol type="circle">
<li>list item 1</li>
<li>list item 2</li>
<li>list item 3</li>
<li>list item 4</li>
</ol>
  1. list item 1
  2. list item 2
    1. sub list item 1
    2. sub list item 2
  1. list item 1
  2. list item 2
  3. list item 3
  4. list item 4

Description list

The <dl>element defines a description list. The <dt> element defines a term and <dd> description of term.

coderesult
<dl>
  <dt>term 1</dt>
  <dd> description of term 1</dd>
  <dt>term 2</dt>
  <dd> description of term 2</dd> 
</dl>
term 1
description of term 1
term 2
description of term 2