CSS list-style-position Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The list-style-position property sets where the list marker (::marker) sits relative to the list item: inside the content or outside the principal block box.

It applies to list items (li and display: list-item) and is inherited. The default is outside. Prefer the list-style shorthand when you also set type or image.

Baseline widely available.

Not deprecated. inside and outside are safe everywhere. Wrapping looks different with inside — that is expected, not a bug.

CSS Syntax

syntax.css
list-style-position: inside | outside | initial | inherit;

Examples: list-style-position: outside; · list-style-position: inside;

Property Values

ValueDescriptionTry it
outsideMarker outside the content box (default)Try it
insideMarker inside the content flowTry it
inside + wrapSee how wrapped lines align under the markerTry it
type + positionSquare marker with insideTry it
initialResets to outsideTry it
inheritTakes the parent’s positionTry it

How to Use list-style-position

Pick where the marker lives relative to the text.

  1. Select a ul or ol.
  2. Set list-style-position to outside (classic) or inside (compact).
  3. Test with a long item so wrapping makes the difference clear.
  4. Combine with list-style-type when you also change the marker kind.
ValueWhen to useWrap behavior
outsideDefault lists, hanging markersNext lines align under the text
insideTighter layouts, less side paddingNext lines continue under the marker

Live Preview

Only list-style-position changes. A long item shows how wrapping differs.

outside hangs the marker. inside pulls it into the text flow.

Sample list
  • Short item
  • A longer item that wraps so you can see marker alignment.

list-style-position: outside

CSS Examples

Each snippet focuses on list-style-position. Use Try It Yourself for a live editor.

Example 1 — Outside (Default)

Keep the classic hanging marker beside the content.

CSS
<style>
  ul {
    list-style-type: square;
    list-style-position: outside;
  }
</style>

<ul>
  <li>Apollo</li>
  <li>Hubble</li>
</ul>
Try It Yourself

How It Works

  1. Default position. outside is the initial value for list markers.
  2. Beside the box. The marker sits outside the principal content box.
  3. Needs indent. Lists usually keep left padding so the marker has room.
  4. Type is separate. square only changes the marker shape.

Example 2 — Inside

Pull the marker into the content flow.

CSS
<style>
  ul {
    list-style-type: square;
    list-style-position: inside;
  }
</style>

<ul>
  <li>Apollo</li>
  <li>Hubble</li>
</ul>
Try It Yourself

How It Works

  1. In the flow. The marker is the first piece of the item’s contents.
  2. Less side space. You can often reduce left padding for a tighter list.
  3. Same type. Position does not change whether you use disc, square, or decimal.
  4. Inherited. Nested items get inside unless they override it.

Example 3 — Wrapping Difference

Use a narrow list so wrapped lines show the real difference.

CSS
<style>
  ul {
    list-style-type: square;
    list-style-position: inside;
    max-width: 14rem;
  }
</style>

<ul>
  <li>Short item</li>
  <li>A longer item that wraps under the marker when space is tight.</li>
</ul>
Try It Yourself

How It Works

  1. Force a wrap. A narrow width makes the second line visible.
  2. Inside align. Wrapped text continues under the marker.
  3. Outside contrast. With outside, wrapped lines would align under the text start.
  4. Study tip. Flip to outside in Try It Yourself to compare.

Edge Cases & Pitfalls

Position looks subtle until wrapping or padding gets involved.

wrap

Wrapping is the real difference

On one short line, inside and outside can look similar. Test with a long item.

padding

outside needs indent

If you set padding-left: 0 with outside, markers can clip or sit off-screen. Keep space for them.

shorthand

list-style can reset position

A later list-style: square sets position back to outside. Include position in the shorthand or set it after.

block

First child as a block

With inside, if the first child is a block, it can move to the line after the marker. Prefer simple text or inline content for study.

display

Needs list items

Markers apply to list items. A plain div needs display: list-item to show them.

Browser Support

list-style-position is a browser CSS property for list markers. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

list-style-position

inside and outside are widely supported across modern and legacy browsers.

100% Common values
Google Chrome All versions
Full support
Mozilla Firefox All versions
Full support
Apple Safari All versions
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support
Samsung Internet All versions
Full support
Internet Explorer All versions
Full support
list-style-position Widely supported

Bottom line: Safe for everyday list layout. Prefer outside for classic lists; use inside when you want a tighter flow. It is not a runtime API.

Key Takeaways

  • Role: places the marker inside or outside the content box.
  • Default: outside — hanging marker beside the text.
  • inside: marker in the flow; wrapped lines sit under it.
  • Padding: keep indent for outside markers.

One line: list-style-position chooses whether the bullet hangs outside or sits in the text flow.

Frequently Asked Questions

It sets whether the list marker (::marker) sits inside the list item's content or outside the principal block box.
The default is outside. The marker hangs beside the content box, usually in the padding/margin area.
outside keeps wrapped lines aligned under the text. inside puts the marker in the content flow, so wrapped lines continue under the marker.
Yes. It applies to list items on both unordered and ordered lists.
Yes. Set it on ul or ol and items inherit it unless a nested list overrides it.
It is Baseline and widely available. It is a browser CSS property, not a Node.js or other runtime feature.

Next: list-style-type

Learn the marker kinds: disc, square, decimal, and more.

list-style-type tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful