Skip to main content

HTML Unordered Lists

The <ul> tag defines an unordered (bulleted) list.


Unordered HTML List

An unordered list starts with the <ul> tag, and each item starts with the <li> tag. By default the items are marked with bullets.

Example

A basic bulleted list.

Prompt
A basic unordered list (ul) with three items: Coffee, Tea, Milk, shown with default bullets.
Output: complete HTML page

Unordered HTML List - Choose List Item Marker

The CSS list-style-type property sets the marker style. Values include disc (a bullet, the default), circle, square, and none (no marker).

Disc

Markers set to bullets.

Prompt
An unordered list with the list-style-type set to disc (bullets), items Coffee, Tea, Milk.
Output: complete HTML page

Circle

Markers set to circles.

Prompt
An unordered list with the list-style-type set to circle, items Coffee, Tea, Milk.
Output: complete HTML page

Square

Markers set to squares.

Prompt
An unordered list with the list-style-type set to square, items Coffee, Tea, Milk.
Output: complete HTML page

None

No markers at all.

Prompt
An unordered list with the list-style-type set to none (no markers), items Coffee, Tea, Milk.
Output: complete HTML page

Nested HTML Lists

Lists can be nested, meaning one list can go inside another.

Note: A list item (<li>) can hold a new list and other elements too, like images and links.

Example

A list with a sub-list inside one item.

Prompt
A nested unordered list: Coffee, Tea (with a sub-list of Black tea and Green tea), and Milk.
Output: complete HTML page

Horizontal List with CSS

Lists can be styled many ways with CSS. A popular one is to lay a list out horizontally to make a navigation menu, using float:left on the items.

Example

A horizontal navigation menu made from a list.

Prompt
A horizontal navigation menu built from an unordered list styled with CSS: no markers, items floated left, dark background, white links with padding, and a darker hover. Links: Home, News, Contact, About.
Output: complete HTML page

Chapter Summary

To recap: use the <ul> element for an unordered list, the CSS list-style-type property for the marker, and the <li> element for each item. Lists can be nested, items can hold other elements, and float:left lays a list out horizontally.


HTML List Tags

The list-related tags are: <ul> (an unordered list), <ol> (an ordered list), <li> (a list item), <dl> (a description list), <dt> (a term), and <dd> (the description of the term).