Menu

HTML List: Bullet Points, Ordered and Nested Lists

How to make lists in HTML: bullet points with <ul>, numbered lists with <ol> (start, reversed, letters and Roman numerals), nested lists, description lists, and styling or removing the bullets with CSS.

This page includes runnable editors - edit, run, and see output instantly.

HTML lists: ul, ol and li

HTML has two main lists. <ul> (unordered list) shows bullet points, and <ol> (ordered list) shows numbers. Each item is an <li> (list item).

Use <ol> when the order means something (steps, rankings, a table of contents) and <ul> when it does not. Screen readers announce both as lists with a count, such as "list, 3 items", which is why a real list is better than lines that start with a typed "•" or "1.".

A list can only contain <li> elements directly. Anything else, including headings, paragraphs and other lists, goes inside an <li>.

Bullet point styles

list-style-type on the <ul> changes the bullet. The ::marker pseudo-element styles the bullet or number itself, separately from the text:

A string value uses that text as the bullet. "\2713 " is a check mark followed by one space: the first space only ends the \2713 escape. ::marker accepts only a few properties, mainly color, font-size and other font properties, which covers the common "colored bullets" request without extra markup.

Ordered lists: numbers, letters and Roman numerals

<ol> has attributes for its numbering:

AttributeExampleResult
typetype="a"a, b, c (A, i, I and 1 also work)
startstart="5"Starts counting at 5
reversedreversedCounts down
value (on <li>)<li value="10">This item is 10, the next ones continue from there

type is fine in HTML because the letters can carry meaning ("choose option B"). For purely visual changes, CSS list-style-type: upper-alpha or lower-roman does the same.

Nested lists

A sub-list goes inside the <li> it belongs to, after that item's text. Browsers change the bullet at each level: disc, then circle, then square.

Note where </li> goes: the "Frontend" item closes only after its sub-list. Closing it before the <ul> puts the sub-list directly inside the outer <ul>, which is invalid even though it looks almost the same.

Ordered lists nest the same way, and the numbering restarts at 1 in each sub-list. For numbers like 1.1 and 1.2, CSS counters are needed.

Description lists: dl, dt and dd

A description list pairs terms with their descriptions: a glossary, the details of an order, FAQ-like pairs. <dt> is the term and <dd> the description:

A term can have several <dd>s, and several <dt>s can share one <dd>. Browsers indent <dd> by default; the margin rule above removes it. For data with several columns, a table is the better fit.

Lists without bullets: menus and horizontal lists

Navigation menus are lists of links. Remove the bullets with list-style: none and the indent with padding: 0, then lay the items out in a row with flexbox:

The list is still a list for screen readers ("navigation, list, 3 items"). One exception: Safari with VoiceOver can drop the list meaning when the bullets are removed. If the count matters to your users, add role="list" to the <ul>.

Default spacing

Browsers give lists a top and bottom margin of 1em and indent them with padding-inline-start: 40px, which is where the bullets sit. The padding is on the start side, so in right-to-left languages the bullets and indentation move to the other side automatically. Remove the padding and the bullets move outside the list box, where they can be cut off; either keep some padding or use list-style-position: inside.

Common mistakes

  • <li> without a parent list. It must be inside <ul>, <ol> or <menu>.
  • A nested list outside its <li>. Put the sub-list inside the item it belongs to.
  • Text or other tags directly inside <ul>, such as <ul><p>Note</p><li>...</li></ul>. Move them into an <li> or out of the list.
  • Typing bullets or numbers by hand with • and <br>. Screen readers hear a paragraph, not a list.
  • list-style: none without padding: 0, leaving a mysterious 40-pixel indent.
  • Using <ol> for the look. If the order does not matter, use <ul> and style it.

Frequently Asked Questions

How do you make bullet points in HTML?

Use an unordered list: <ul> with one <li> per bullet, for example <ul><li>Milk</li><li>Eggs</li></ul>. The browser draws a bullet before each item and indents the list.

What is the difference between ul and ol?

<ul> is an unordered list, shown with bullets, for items whose order does not matter. <ol> is an ordered list, shown with numbers, for steps and rankings where order does matter. Both hold <li> items.

How do I remove the bullets from a list in HTML?

Set list-style: none on the <ul> in CSS. Also set padding-inline-start: 0 (or padding: 0) to remove the indentation the browser adds for the bullets.

How do I start an ordered list at a different number?

Use the start attribute: <ol start="5"> numbers the first item 5. reversed counts down instead, and value on an <li> sets the number of that item and the ones after it.

How do you make a nested list in HTML?

Put the inner <ul> or <ol> inside an <li> of the outer list, after that item's text. A list placed directly inside another <ul>, between <li> elements, is invalid.

Coddy programming languages illustration

Learn to code with Coddy

GET STARTED