CSS list-style Property

The CSS list-style property is a shorthand property that controls the appearance and positioning of list item markers.

It combines list-style-type, list-style-position, and list-style-image into one declaration. You can use it to display bullets, numbers, custom marker styles, or images, and to position markers inside or outside the list item's content box.

list-style Syntax

The list-style shorthand accepts values for marker type, marker position, and marker image. You can specify one, two, or all three components.

Basic Syntax

selector {
  list-style: type position image;
}

The example above illustrates the components rather than literal CSS values.

Marker Type

ul {
  list-style: square;
}

Marker Position

ul {
  list-style: inside;
}

Type and Position

ul {
  list-style: circle inside;
}

Image Marker

ul {
  list-style: url("images/bullet.svg") outside;
}

Image with Fallback Marker

ul {
  list-style: square url("images/bullet.svg") outside;
}

Remove Markers

ul {
  list-style: none;
}

CSS-Wide Keywords

ul {
  list-style: initial;
}
ul {
  list-style: inherit;
}
ul {
  list-style: unset;
}
ul {
  list-style: revert;
}
ul {
  list-style: revert-layer;
}

CSS-wide keywords must be used alone rather than combined with other shorthand values.

Property Values

The list-style property combines three longhand properties.

Component Description Initial Value
list-style-type Defines the marker style, such as bullets, numbers, or custom counter styles. disc
list-style-position Controls whether the marker is positioned inside or outside the principal content box. outside
list-style-image Specifies an image to use as the marker. none

Common Values

Value Description
disc Displays a filled circular bullet.
circle Displays a hollow circular bullet.
square Displays a square bullet.
decimal Displays decimal numbering.
lower-alpha Displays lowercase alphabetic markers.
upper-roman Displays uppercase Roman numerals.
inside Places the marker inside the principal content box.
outside Places the marker outside the principal content box.
url() Specifies an image marker.
none Removes the marker type or image, depending on its position in the shorthand.

Property Characteristics

Characteristic Value
Initial value disc outside none
Inherited Yes
Applies to List items
Computed value Determined separately for each longhand property
Animation type Determined separately for each longhand property
Percentages Not applicable
Primary purpose Control list item markers

The shorthand resets any omitted components to their initial values. It does not preserve previously declared longhand values.

How It Works

Browsers normally display a marker for elements with display: list-item, including ordinary <li> elements.

Default Unordered List

<ul>
  <li>HTML</li>
  <li>CSS</li>
  <li>JavaScript</li>
</ul>

An unordered list typically uses filled circular markers.

Change the Marker

ul {
  list-style: square;
}

The list now uses square markers.

Change the Position

ul {
  list-style: square inside;
}

The square markers become part of the list item's inline content layout.

Use an Image

ul {
  list-style: url("images/checkmark.svg") outside;
}

If the image loads successfully, it replaces the ordinary marker.

Important Consideration

The shorthand changes marker styling, not the underlying HTML list structure. Use <ul> for unordered lists and <ol> for ordered sequences.

list-style-type

The list-style-type component determines the kind of marker displayed for each list item.

Filled Bullets

ul {
  list-style: disc;
}

Hollow Bullets

ul {
  list-style: circle;
}

Square Bullets

ul {
  list-style: square;
}

Decimal Numbers

ol {
  list-style: decimal;
}

Alphabetic Markers

ol {
  list-style: lower-alpha;
}

Roman Numerals

ol {
  list-style: upper-roman;
}

Custom Text Marker

ul {
  list-style: "✓ ";
}

A string can be used as a marker type. Unlike a generated counter style, the same string is displayed for every item.

Important Consideration

The marker type is independent of the HTML list element. An ordered list can use bullets, and an unordered list can display numbers, although the HTML semantics remain unchanged.

list-style-position

The list-style-position component controls whether the marker appears inside or outside the list item's principal content box.

Outside Position

ul {
  list-style: disc outside;
}

The marker is positioned outside the principal content box. Wrapped lines normally align with the text rather than the marker.

Inside Position

ul {
  list-style: disc inside;
}

The marker participates in the inline content at the beginning of the list item. Wrapped lines may align differently from those using outside.

Position with Numbers

ol {
  list-style: decimal inside;
}

Position with Square Bullets

ul {
  list-style: square outside;
}

Important Consideration

Marker position affects text wrapping and alignment. For long list items, outside is often easier to read because continuation lines align with the text.

list-style-image

The list-style-image component allows an image to replace the normal list marker.

Image Marker

ul {
  list-style: url("images/bullet.svg");
}

Image and Position

ul {
  list-style: url("images/arrow.svg") inside;
}

Image with Fallback Type

ul {
  list-style: square url("images/bullet.svg") outside;
}

If the image is unavailable, the browser can use the square marker.

Gradient Marker

ul {
  list-style: disc linear-gradient(45deg, #2563eb, #93c5fd) outside;
}

CSS image values such as gradients can be used as list markers, although their sizing and appearance may vary.

Important Consideration

The list-style-image property does not provide direct width and height controls for the marker image. For precise image sizing and positioning, consider a pseudo-element or another custom marker technique.

Shorthand Value Order

The components of list-style can generally be written in any order because their value types are distinguishable.

Type Followed by Position

ul {
  list-style: square inside;
}

Position Followed by Type

ul {
  list-style: inside square;
}

Type, Image, and Position

ul {
  list-style: disc url("images/bullet.svg") outside;
}

Position, Type, and Image

ul {
  list-style: outside disc url("images/bullet.svg");
}

Omitted Values Reset

ul {
  list-style-position: inside;
  list-style: square;
}

The second declaration resets list-style-position to outside and list-style-image to none.

Important Consideration

Use a consistent order, such as type, position, and image, to make shorthand declarations easier to read and maintain.

none Value

The none keyword can disable a marker type or image. Its interpretation depends on the other shorthand values.

Remove All Markers

ul {
  list-style: none;
}

This sets both list-style-type and list-style-image to none.

Remove Image but Keep a Bullet

ul {
  list-style: disc none outside;
}

The explicit disc value provides the marker type, while none disables the image.

Remove Type but Keep an Image

ul {
  list-style: none url("images/bullet.svg") outside;
}

The image is used when available, but there is no marker-type fallback if it fails.

Reset a Navigation List

.navigation-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

Important Consideration

Removing visual markers can affect how some screen readers identify lists, particularly in Safari. Keep the list semantics intact and test accessibility when using list-style: none.

Unordered Lists

Unordered lists are typically marked with bullets. The list-style property allows you to choose a different marker.

Disc Markers

ul {
  list-style: disc outside;
}

Circle Markers

ul {
  list-style: circle outside;
}

Square Markers

ul {
  list-style: square outside;
}

Custom Character Markers

ul {
  list-style: "✓ ";
}

Scoped List Styling

.feature-list {
  list-style: square outside;
}

Using a class prevents the style from unintentionally affecting every unordered list on the website.

Important Consideration

Use unordered lists when the order of items does not affect their meaning. Changing marker appearance does not change that semantic purpose.

Ordered Lists

Ordered lists represent sequences where item order matters. CSS can change the marker format without changing the underlying sequence.

Decimal Numbers

ol {
  list-style: decimal outside;
}

Leading-Zero Numbers

ol {
  list-style: decimal-leading-zero;
}

Lowercase Letters

ol {
  list-style: lower-alpha;
}

Uppercase Letters

ol {
  list-style: upper-alpha;
}

Lowercase Roman Numerals

ol {
  list-style: lower-roman;
}

Uppercase Roman Numerals

ol {
  list-style: upper-roman;
}

Important Consideration

The HTML start, reversed, and value attributes control aspects of ordered-list numbering. CSS marker styling does not replace those HTML features.

Custom List Markers

CSS provides several ways to customize list markers beyond standard bullets and numbering.

Unicode Character

.check-list {
  list-style: "✓ ";
}

Arrow Character

.arrow-list {
  list-style: "→ ";
}

Custom Counter Style

@counter-style custom-arrows {
  system: cyclic;
  symbols: "➜";
  suffix: " ";
}
.arrow-list {
  list-style: custom-arrows outside;
}

Image Marker

.icon-list {
  list-style: url("images/checkmark.svg") outside;
}

Important Consideration

For custom markers requiring precise dimensions, backgrounds, or animation, a ::before pseudo-element may offer more control. However, replacing native markers requires additional attention to spacing and accessibility.

The ::marker Pseudo-Element

The ::marker pseudo-element allows you to style the marker box of a list item.

Change Marker Color

li::marker {
  color: #2563eb;
}

Change Marker Size

li::marker {
  font-size: 1.25em;
}

Bold Numbered Markers

ol li::marker {
  font-weight: bold;
}

Custom Marker Content

.custom-list li::marker {
  content: "✓ ";
  color: #15803d;
}

Important Consideration

The ::marker pseudo-element supports a limited set of CSS properties. Layout properties such as padding, margin, and transform cannot be used to position native markers in the same way as ordinary elements.

Nested Lists

Nested lists can use different marker styles at each level to make their hierarchy easier to understand.

HTML Example

<ul class="nested-list">
  <li>HTML
    <ul>
      <li>Elements</li>
      <li>Attributes</li>
    </ul>
  </li>
  <li>CSS
    <ul>
      <li>Selectors</li>
      <li>Properties</li>
    </ul>
  </li>
</ul>

CSS Example

.nested-list {
  list-style: disc outside;
}
.nested-list ul {
  list-style: circle outside;
}

Third-Level Lists

.nested-list ul ul {
  list-style: square outside;
}

Important Consideration

Because list styling is inherited, apply styles to the intended nesting levels when you need predictable markers throughout a complex list.

display: list-item

List markers are generated by elements that use the list-item display type.

Ordinary List Items

li {
  display: list-item;
  list-style: disc outside;
}

Custom List-Item Display

.custom-item {
  display: list-item;
  list-style: square outside;
}

Removing the List-Item Display Type

li {
  display: block;
}

Changing the display type to block removes the native list-item marker box.

Important Consideration

Use semantic HTML list elements for actual lists. Applying display: list-item to unrelated elements does not automatically provide the same document semantics as <ul>, <ol>, and <li>.

Spacing and Alignment

The list-style property controls marker appearance and positioning, but margins and padding determine much of the spacing around the list.

List Indentation

ul {
  list-style: disc outside;
  padding-left: 2rem;
}

Compact List

.compact-list {
  list-style: square outside;
  margin: 0;
  padding-left: 1.5rem;
}

Spacing Between Items

.spaced-list {
  list-style: disc outside;
}
.spaced-list li {
  margin-bottom: 0.5rem;
}

Inside Markers

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

Important Consideration

Removing all list padding while using outside markers can cause markers to extend beyond the intended container. Leave enough room for markers, especially when using numbered lists with multiple digits.

Accessibility

List markers provide visual cues, but the underlying HTML list structure communicates relationships between items to assistive technologies.

Preserve Semantic HTML

<ul>
  <li>HTML Elements</li>
  <li>CSS Properties</li>
  <li>JavaScript Basics</li>
</ul>

Removing Markers

.navigation-list {
  list-style: none;
}

Some combinations of Safari and VoiceOver may not announce a list as expected when its markers are removed. Test the result when list semantics are important.

Navigation Lists

<nav aria-label="Main navigation">
  <ul class="navigation-list">
    <li><a href="/">Home</a></li>
    <li><a href="/about.html">About</a></li>
    <li><a href="/contact.html">Contact</a></li>
  </ul>
</nav>

When a list must be announced consistently, consider the tested behavior of your supported screen readers and browsers. An explicit role="list" on the list container can help address marker-removal issues in some combinations.

Avoid Meaning Based Only on Marker Appearance

Do not rely solely on different marker colors or shapes to communicate required information.

Image Markers

Decorative marker images should not be the only way essential meaning is communicated. Include meaningful text within each list item.

Important Consideration

Changing marker appearance should not interfere with the list's structure, reading order, or ability to be understood without visual styling.

list-style Example

This example compares disc, circle, square, decimal, and inside-positioned list markers.

HTML Example

<div class="list-style-demo">
  <div class="demo-item">
    <h3>Disc</h3>
    <ul class="disc-list">
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ul>
  </div>
  <div class="demo-item">
    <h3>Circle</h3>
    <ul class="circle-list">
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ul>
  </div>
  <div class="demo-item">
    <h3>Square</h3>
    <ul class="square-list">
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ul>
  </div>
  <div class="demo-item">
    <h3>Decimal</h3>
    <ol class="decimal-list">
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ol>
  </div>
  <div class="demo-item">
    <h3>Inside</h3>
    <ul class="inside-list">
      <li>HTML</li>
      <li>CSS</li>
      <li>JavaScript</li>
    </ul>
  </div>
</div>

CSS Example

.list-style-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
}
.list-style-demo .demo-item {
  padding: 15px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
}
.list-style-demo h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.list-style-demo ul,
.list-style-demo ol {
  margin: 0;
  padding-left: 1.5rem;
}
.list-style-demo li {
  margin-bottom: 5px;
}
.list-style-demo .disc-list {
  list-style: disc outside;
}
.list-style-demo .circle-list {
  list-style: circle outside;
}
.list-style-demo .square-list {
  list-style: square outside;
}
.list-style-demo .decimal-list {
  list-style: decimal outside;
}
.list-style-demo .inside-list {
  list-style: disc inside;
  padding-left: 0;
}
Browser Result

Disc

  • HTML
  • CSS
  • JavaScript

Circle

  • HTML
  • CSS
  • JavaScript

Square

  • HTML
  • CSS
  • JavaScript

Decimal

  1. HTML
  2. CSS
  3. JavaScript

Inside

  • HTML
  • CSS
  • JavaScript

The first three lists demonstrate different bullet shapes. The fourth uses decimal numbering, while the fifth places its markers inside the content box.

Change to Roman Numerals

.list-style-demo .decimal-list {
  list-style: upper-roman outside;
}

Remove Markers

.list-style-demo .disc-list {
  list-style: none;
}

These changes affect marker presentation without changing the HTML list structure.

Common Mistakes

Assuming list-style Works on Every Element

List markers are generated by list-item boxes. Applying list-style to an ordinary block does not automatically create a marker.

Forgetting That the Shorthand Resets Values

ul {
  list-style-position: inside;
  list-style: square;
}

The second declaration resets the marker position to outside.

Confusing inside and outside

These values change marker placement and how text wraps. They do not control the marker's color or shape.

Removing List Padding Without Checking Markers

Outside markers can extend beyond the container when there is insufficient indentation.

Using Images Without Fallbacks

ul {
  list-style: none url("images/bullet.svg");
}

If the image fails, there is no marker-type fallback. Use a suitable type when a visible fallback is needed.

Expecting list-style-image to Control Image Size

The property does not provide separate marker width and height settings.

Using list-style to Change HTML Semantics

Changing an unordered list to numbered markers does not convert it into an ordered list semantically.

Removing Markers Without Considering Accessibility

Marker removal can affect list announcements in some screen reader and browser combinations.

Using ::marker Like an Ordinary Element

The ::marker pseudo-element supports a restricted set of CSS properties.

Styling Every List Globally

A broad selector such as ul may unintentionally affect navigation, footers, and nested lists. Use scoped classes when appropriate.

Using Decorative Characters Instead of Semantic Lists

Typing bullet characters into paragraphs does not provide the same semantic structure as HTML list elements.

Important Considerations

Keep the following points in mind when using list-style:

  • The property is a shorthand for three list marker properties.
  • It controls marker type, position, and image.
  • The shorthand is inherited.
  • Its initial components are disc outside none.
  • Markers are generated for elements using the list-item display type.
  • Common marker types include disc, circle, and square.
  • Numbered marker types include decimal, alphabetic, and Roman numeral styles.
  • Custom marker strings are supported.
  • Custom counter styles can be defined using @counter-style.
  • The inside value places markers within the principal content box.
  • The outside value places markers outside the principal content box.
  • Marker positioning affects text wrapping.
  • Images can replace standard markers.
  • A marker type can serve as a fallback when an image fails.
  • The shorthand components can generally appear in different orders.
  • Omitted shorthand components reset to their initial values.
  • list-style: none removes native markers.
  • Removing markers does not change the HTML list structure.
  • Some assistive technologies may treat marker-free lists differently.
  • The ::marker pseudo-element provides additional styling options.
  • Marker styling through ::marker is limited to supported properties.
  • Margins and padding control much of the list's indentation.
  • Nested lists can use different marker styles at each level.
  • Ordered and unordered lists retain their HTML semantics regardless of marker style.
  • Use scoped selectors to avoid unintended changes to other lists.
  • Test custom markers across browsers and assistive technologies.

Browser Support

The CSS list-style property is widely supported across modern browsers, including Chrome, Edge, Firefox, Safari, and Opera.

Standard marker types, positioning, and image markers have long-established support. More advanced features, such as custom counter styles and particular CSS image values, may have different compatibility requirements.

For current compatibility information, visit Can I Use? and search for list-style.

Specifications

The list-style property is defined in the CSS Lists and Counters Module Level 3 specification.

CSS Lists and Counters Module Level 3: list-style

The specification defines list markers, marker positioning, list style types, and the shorthand syntax.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: list-style