πŸ“ CSS Tutorial: list-style-position

πŸ“Œ Introduction

The list-style-position property in CSS controls where the bullet (or list marker) appears relative to the list item's content. This is especially useful for adjusting list alignment, improving readability, and styling lists within narrow layouts or UI components. ✨

🎯 Why Use list-style-position?

  • To control whether bullets sit inside or outside the text block πŸ“
  • To create cleaner layouts for navigation, sidebars, or feature lists 🎨
  • To prevent awkward text indenting in narrow containers πŸ“±
  • To ensure bullets align properly in complex UI layouts 🧩

✨ Syntax

Basic Syntax

selector {
  list-style-position: inside | outside;
}

🧩 Available Values

1. outside (default)

The bullet appears outside the text block. The first line starts at the left, and subsequent lines wrap under the textβ€”not under the bullet.

outside Example

ul {
  list-style-position: outside;
}

2. inside

The bullet appears inside the content box. This means wrapped lines align under the bullet, giving a more compact block-like appearance.

inside Example

ul {
  list-style-position: inside;
}

Note

Tip: Use inside when working with narrow columns or mobile layouts, and outside for clean, traditional listing.

πŸ”₯ Practical Examples

1. Clean, Traditional Blog List

Traditional List

article ul {
  list-style-position: outside;
  list-style-type: disc;
  line-height: 1.6;
}

2. Compact Mobile-Friendly List

Mobile Layout

.mobile-list {
  list-style-position: inside;
  padding-left: 0;
}

3. Feature List With Custom Icon + Inside Position

Custom Icon Example

.features {
  list-style-image: url("icons/check.svg");
  list-style-position: inside;
}

πŸ“Š Comparison Table

ValueBullet PositionText Wrap BehaviorBest For
outsideOutside content boxWrapped lines align under textBlogs, standard UI, clean layouts
insideInside content boxWrapped lines align under the bulletMobile layouts, tight spaces

πŸ–ΌοΈ Visual Side-by-Side Demo

>>β€œEven small details like bullet alignment can dramatically improve readability.” ✨

πŸŽ‰ Conclusion

The list-style-position property gives you precise control over how list bullets and text align. Use outside for classic layouts and inside when working with narrow or mobile-friendly designs. Pair it with list-style-type orlist-style-image to build beautifully styled lists. πŸš€