Styling Lists

Change list markers, position, and spacing.

Syntaxlist-style-type: square;

List properties control bullet and number styling:

  • list-style-type — disc, circle, square, decimal, none.
  • list-style-position — inside or outside.
  • list-style-image — a custom marker image.

Setting list-style: none and removing padding is common when building navigation menus.

Example

Try it yourself
Loading editor…
Press Run to see the result.

When to use it

  • A developer removes the default bullet style from a navigation ul with list-style: none to style it as a horizontal menu.
  • A designer uses list-style-type: decimal-leading-zero on an ordered list in a step-by-step guide to display steps as 01, 02, 03.
  • A developer uses a custom SVG icon as a list-style-image to replace default bullets with branded check marks.

More examples

Remove bullets for nav menu

Strips default list bullets and padding then makes the list horizontal with flexbox — a common nav pattern.

Example · css
.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 16px;
}

Custom bullet style and position

Uses list-style-position: inside to keep bullets within the element's box, and decimal numbering for ordered steps.

Example · css
ul.features {
  list-style-type: disc;
  list-style-position: inside;
  padding-left: 0;
}
ol.steps {
  list-style-type: decimal;
  padding-left: 1.5rem;
}

Custom image as list marker

Replaces bullets with a custom SVG check icon using a background image positioned on the left of each list item.

Example · css
ul.checklist {
  list-style: none;
  padding: 0;
}
ul.checklist li {
  padding-left: 28px;
  background: url('check-icon.svg') no-repeat left center / 18px 18px;
  margin-bottom: 8px;
}

Discussion

  • Be the first to comment on this lesson.
Styling Lists — CSS | SoundsCode