# Styling a List That Stays a List

When a list should still look like a list, list-style-type, list-style-position, the list-style shorthand and ::marker change its bullets and numbers, and a few spacing rules make long and nested lists comfortable to read.

Apprentice · CSS · Updated November 14, 2026

## After this lesson you can

- Change a list's markers with list-style-type, list-style-position and the list-style shorthand
- Color and size a list's markers with ::marker, and space out a list's items and the lists nested inside it

## Key takeaways

- list-style-type picks the marker. disc, circle or square bullets, decimal numbers, letters, roman numerals, none, or characters of your own in quotes, such as "✓ ".
- list-style-position outside hangs the marker in the indent, so a wrapped line lines up with the text. inside puts the marker in the first line, inside the item's box.
- The list-style shorthand sets the type, the position and a picture in one line, in any order. A part you leave out goes back to its default.
- ::marker styles the marker on its own, such as its color and size. list-style goes on the ul or ol, and ::marker on the li.
- Space items apart with a margin between them, such as li + li { margin-top: 0.5rem; }, and reach a list inside a list with a descendant selector.

Recipes, instructions, a packing list for a trip, the numbered rules of a contest with lettered parts under each rule: plenty of lists on the web should still look like lists. They need to look like *your* lists, not the browser's black dots crammed together. This lesson changes a list's markers and spacing while it stays a list.

Paws & Whiskers gives every new family a page called *Bringing Your Pet Home*. It has two lists: a **packing checklist** for the day you pick up your pet, and the steps for **Biscuit's Peanut Butter Treats**, the dog treats the volunteers bake on Saturdays. The volunteers want checkmarks on the checklist and big red numbers on the recipe.

## The plain try: type the marks yourself

The first idea most people have is to type the checkmarks and the numbers into the text:

```html
<p>✓ A leash and a collar</p>
<p>✓ A crate or a carrier</p>
<p>1. Mix the flour and the oats.</p>
<p>2. Stir in the peanut butter and the pumpkin.</p>
```

It looks right, and it breaks in three ways. The paragraphs aren't a list anymore, so a screen reader can't say "list, 2 items" (*Lists Hold Collections: ul, ol and What the Browser Adds* showed why that matters). When a volunteer adds a step in the middle, every number after it has to be typed again. And if you put typed numbers inside an `<ol>`, the browser numbers them as well, so each step reads "1. 1. Mix the flour". Keep the list, and change its markers with CSS.

## list-style-type: choosing the marker

The **`list-style-type`** property picks the marker in front of each item. Here are its common values:

| Value | The marker | Good for |
|---|---|---|
| `disc` | ● a filled circle (the `<ul>` default) | most bulleted lists |
| `circle` | ○ a hollow circle | a list inside a list |
| `square` | ■ a filled square | a change from round bullets |
| `decimal` | 1. 2. 3. (the `<ol>` default) | steps |
| `decimal-leading-zero` | 01. 02. 03. | lists that reach 10 or more and should line up |
| `lower-alpha`, `upper-alpha` | a. b. c. and A. B. C. | choices, or parts inside a numbered step |
| `lower-roman`, `upper-roman` | i. ii. iii. and I. II. III. | outlines, chapters, contest rules |
| `none` | no marker at all | lists that shouldn't look like lists (the next lesson) |
| `"✓ "` | the characters you write, in quotes | a checkmark, a paw print, an arrow |

Put it on the list itself, the `<ul>` or the `<ol>`. It's inherited, so every `<li>` inside gets it:

```css
.packing-list {
  list-style-type: "✓ ";
}

.treat-steps {
  list-style-type: decimal-leading-zero;
}
```

A value in quotes is a **string**: the marker is exactly those characters. Put a space before the closing quote, or the marker touches the first word. A string can be any character, an emoji such as `"🐾 "` included. Some screen readers read a string marker aloud ("check mark"), so pick one that still makes sense when it's heard.

The marker changes the look, never the meaning. A `<ul>` with `decimal` shows numbers, but a screen reader still treats it as a list whose order doesn't matter. Choose the element for what the list means, and the marker for how it should look.

**Try it.** In your `adoption-list` folder, make `pet-home.html` with a page skeleton, a `<style>` element, a `<ul class="packing-list">` with four things to pack (a leash and a collar, a crate or a carrier, the food your pet ate at the shelter, a soft blanket), and an `<ol class="treat-steps">` with four steps (mix the flour and the oats; stir in the peanut butter and the pumpkin; roll the dough and cut out bone shapes; bake for 20 minutes and let them cool). Try five values from the table on each list.

## list-style-position: outside or inside

Long items wrap onto a second line, and where the marker sits decides how that looks. Think of a flag on a pole: the flag can hang out to the side of the pole, or be painted on the pole itself.

- **`outside`**, the default, hangs the marker outside the item's box, in the list's indent. The second line of a long item lines up under the first line's text, so the marker stands alone at the left and the items are quick to scan.
- **`inside`** puts the marker inside the item's box, as the first thing on its first line, like the first word of a sentence. The second line starts under the marker.

```css
.packing-list {
  list-style-position: inside;
}
```

Use `outside` for most lists of text. `inside` fits when each item is a box with a background or a border, because the marker then sits inside the box with its text, instead of hanging out in the white space beside it.

![One packing-list item whose text wraps onto two lines, shown twice with the item's box outlined: with outside, the checkmark hangs to the left of the box and both lines of text start at the same place; with inside, the checkmark sits inside the box at the start of the first line, and the second line starts under the checkmark](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/cb19cc0c47c04833ae286623ad55e3bb.webp)

## The list-style shorthand, and its trap

**`list-style`** sets three things in one line: the type, the position, and a picture to use as the marker (`list-style-image: url(paw.png)`, which is rarely used now that a string marker or `::marker`, below, can do the same job). The parts can come in any order:

```css
.packing-list {
  list-style: "✓ " inside;
}
```

The trap is the one *Pictures from CSS: Background Images* showed for the `background` shorthand: a part you leave out isn't left alone, it goes back to its default. So this rule, meant only to move the recipe's numbers inside, turns them into bullets:

```css
.treat-steps {
  list-style: inside;
}
```

The shorthand set the position, and set the type back to its default, `disc`. Write `list-style: decimal-leading-zero inside;` to keep both, or use `list-style-position` on its own. `list-style: none;` is the shorthand you'll write most often: it takes the markers away, and the next lesson builds on it.

## Coloring and sizing the markers with ::marker

The volunteers want the recipe's numbers big and red, but the step text should stay dark blue. A marker has the same color and size as its item's text, so changing the `<li>` changes both. *Pseudo-Elements: ::before, ::after and ::marker* showed the tool for styling the marker on its own: the **`::marker`** pseudo-element, read "double colon marker".

```css
.treat-steps li::marker {
  color: #e63946;
  font-size: 1.25rem;
}
```

Read the selector as "the marker of each `<li>` in the treat steps". Two things to keep straight:

- **`list-style` goes on the list, and `::marker` goes on the item.** Each `<li>` has its own marker, so the selector ends in `li::marker`.
- **Keep to `color` and `font-size`.** As of October 2026, Safari styles only those two on a marker, so the numbers are red and big in every current browser. A bold weight shows in Chrome, Edge and Firefox, but not in Safari.

## Space between items, and lists inside lists

Long steps crammed one on top of another are hard to follow while your hands are covered in dough. Space them apart with a margin **between** the items, not above the first one:

```css
.treat-steps li + li {
  margin-top: 0.75rem;
}
```

`li + li`, read "L I next-sibling L I", is the next-sibling combinator from *Combinators: Descendant, Child and Sibling*: it picks every `<li>` that comes right after another `<li>`, which is every item but the first. So the gap goes between the steps, and the list starts right where it should. A `line-height` of about 1.5 on the list also helps when the items wrap onto more lines.

The packing checklist has a list inside one of its items, for the food:

```html
<ul class="packing-list">
  <li>A leash and a collar</li>
  <li>A crate or a carrier</li>
  <li>Food
    <ul>
      <li>The food your pet ate at the shelter</li>
      <li>A few treats</li>
    </ul>
  </li>
  <li>A soft blanket</li>
</ul>
```

As the last lesson showed, the browser gives the inner list hollow `circle` bullets and another 40 pixels of indent. A **descendant selector** (a space between two selectors) reaches it without a class of its own:

```css
.packing-list ul {
  list-style-type: "– ";
  padding-left: 1.5rem;
}
```

The rule reads "any `<ul>` inside the packing list": the inner list gets a dash for each item and a smaller indent, so it sits clearly under *Food* without pushing far to the right.

![The Bringing Your Pet Home page finished: a packing checklist with a checkmark in front of each item and a short dashed list under Food, and Biscuit's Peanut Butter Treats as four steps numbered 01 to 04 in large red numbers, with space between the steps](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/8d7f5c5e57c54e4d97e698166e393c42.webp)

## Do it: number the volunteer house rules

Paws & Whiskers prints its volunteer house rules on the wall by the front desk, numbered like an old club rulebook, with lettered parts under some rules. The volunteers want the page to match the poster:

- The rules numbered with **capital Roman numerals**: I, II, III.
- The parts under a rule **lettered in small letters**: a, b.
- The numbers in front of the rules in the shelter's blue, `#457b9d`, while the rules' words stay dark blue.
- `0.75rem` of space **between** the rules, and none above the first one.

Practiced live on the lesson page: write the CSS right there and check it.

## Check yourself

2 questions to try on the lesson page.

## So what

A list that stays a list can still look like it belongs on your page: checkmarks, letters, big red numbers and room to breathe, while screen readers keep hearing a list. When a list shouldn't look like a list at all, the next lesson takes all of that away.

## Key terms

- [List style type](https://www.ask-codey.com/glossary/list-style-type)
- [List style position](https://www.ask-codey.com/glossary/list-style-position)
- [List style](https://www.ask-codey.com/glossary/list-style)
- [::marker](https://www.ask-codey.com/glossary/marker)

## Cheat sheets

- [Styling a List That Stays a List](https://www.ask-codey.com/cheat-sheets/css-styling-lists-cheat-sheet)

## Related

- [Lists Hold Collections: ul, ol and What the Browser Adds](https://www.ask-codey.com/lessons/css-lists-hold-collections)
- [Pseudo-Elements: ::before, ::after and ::marker](https://www.ask-codey.com/lessons/css-pseudo-elements)
- [Lists as Containers: Strip the Defaults, Style the Items](https://www.ask-codey.com/lessons/css-lists-as-containers)

Source: https://www.ask-codey.com/lessons/css-styling-lists
