πŸ“ CSS Tutorial: list-style (Shorthand)

πŸ“Œ Introduction

The list-style property in CSS is a shorthand that lets you define all list marker styles in a single line. Instead of writing list-style-type, list-style-position, andlist-style-image separately, you can combine them using list-style. This is perfect for styling lists in blogs, menus, sidebars, and UI sections with clean and simple CSS. ✨

🎯 What Does list-style Control?

  • list-style-type – bullet/number style πŸ”’
  • list-style-position – bullet placement πŸ“
  • list-style-image – custom bullet image πŸ–ΌοΈ

✨ Syntax

Shorthand Syntax

selector {
  list-style: type position image;
}

Note

All three values are optional. You can include just one, two, or all of them β€” and the order does not matter.

🧩 Individual Parts Explained

1. list-style-type

Controls bullet or number style.

  • disc, circle, square
  • decimal, upper-roman, lower-alpha
  • none (no bullet)

2. list-style-position

  • outside – bullet outside text block (default)
  • inside – bullet aligned within content area

3. list-style-image

Replaces bullet with any custom image.

Image Example

list-style-image: url("icon.png");

πŸ”₯ Practical Examples

1. Simple Disc List

Simple Example

ul {
  list-style: disc;
}

2. Inside Positioned Square Bullets

Inside Square Example

ul {
  list-style: square inside;
}

3. Using Custom Icon as Bullet

Custom Image Example

ul {
  list-style: url("icons/check.png") outside;
}

4. Removing Bullets Entirely

No Bullets

ul {
  list-style: none;
}

5. Full Combination: Type + Position + Image

Full Combination

ul {
  list-style: square inside url("icons/star.svg");
}

πŸ“Š Comparison Table

ShorthandExpands To
list-style: square inside;list-style-type: square;
list-style-position: inside;
list-style: none;list-style-type: none;
list-style-image: none;
list-style: url("icon.png") outside;list-style-image: url("icon.png");
list-style-position: outside;

πŸ–ΌοΈ Visual Demo

>>β€œGreat UI design is about clarity β€” and even your list markers play a role.” ✨

πŸŽ‰ Conclusion

The list-style shorthand property helps you control list marker appearance efficiently in a single line of CSS. It combines list-style-type, list-style-position, andlist-style-image, making your CSS shorter, cleaner, and more readable. πŸš€ Use it whenever you want quick and beautiful control over list styling!