Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Lists, Tables and Generated Content

The list-style-position property

Reference for the CSS list-style-position property: place list markers inside or outside the item's content box, and see how wrapped text lines up.

The list-style-position property decides whether the marker sits outside the list item's content box, hanging in the margin so wrapped lines align with the first line's text, or inside, as if it were the first inline piece of the item's content.

CSS
li { list-style-position: inside; }

Try it

Outside versus inside

The blue strips are the <li> boxes. With outside the bullet sits to the left of the strip; with inside it is part of it.

Syntax

CSS
list-style-position: outside | inside;
Initial value outside
Applies to List items
Inherited Yes
Animatable No
Computed value As specified

Values

Value Description
outside The marker is placed outside the principal box, in the space before it. Text wraps under the item text, giving a hanging indent.
inside The marker is placed inside the box as the first inline content. Wrapped lines flow under the marker.

Usage notes

  • Outside needs room. An outside marker is drawn in the area to the left (or right, in right-to-left text) of the item. If the parent has no padding or margin there, the marker may be clipped or overflow, which is why browsers give lists default start padding.
  • Backgrounds and borders. A background on <li> does not cover an outside marker. Use inside, or style a ::before, when the marker must sit on the colored area.
  • Centered text. With text-align: center, inside keeps the marker next to the text, while outside leaves it stranded at the edge.
  • Inside markers affect layout. They take up width in the first line; outside markers do not.
  • Styling the marker. Use ::marker to change its color or size in either position.

Browser support

Supported in all browsers.