list-style-position

Sets whether the list marker sits outside or inside the element’s block.

Initial value
outside
Inherited
Yes
Animatable
no
Applies to
list items (display: list-item)
JavaScript
element.style.listStylePosition = "inside"
On this page

Example

#
CSS
.steps {
  list-style-position: inside;
}

.steps li {
  padding: 8px 12px;
  border-radius: 8px;
  background: #18181b;
}
Preview

Definition and usage

#

The list-style-position property decides where a list item’s marker is drawn. With outside (the default) the marker hangs to the left of the text block, and subsequent lines align with the first line of text.

With inside, the marker becomes part of the first line of text, and wrapped lines start under the marker, at the block’s edge.

The difference is easiest to see with longer, wrapping items and with list items that have a background or border.

Syntax

#
Syntax
list-style-position: outside | inside;

Values

#
  • outside

    The marker is outside the element’s background, the text is aligned in a column.
  • inside

    The marker is in the first line, inside the background.

Values in practice

#

outside

The marker is outside the element’s background, the text is aligned in a column.
.demo { list-style-position: outside; }

inside

The marker is in the first line, inside the background.
.demo { list-style-position: inside; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • In lists with a background on the items, inside usually looks better, because the number doesn’t stick out of the tile.
  • For long text, outside is more readable, because the lines form an even column.

Related entries

#

Spotted a mistake or missing an example? Write to us.