CSS list-style-image Property

The CSS list-style-image property specifies an image to use as the marker for a list item instead of a standard bullet or number.

It allows you to customize list markers using image files, SVG graphics, or supported CSS image functions. When an image cannot be displayed, the browser uses the marker defined by list-style-type as a fallback.

list-style-image Syntax

The list-style-image property accepts the keyword none or a CSS image value.

Basic Syntax

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

Available Values

ul {
  list-style-image: none;
}
ul {
  list-style-image: url("images/bullet.png");
}
ul {
  list-style-image: url("images/checkmark.svg");
}
ul {
  list-style-image: linear-gradient(45deg, #2563eb, #93c5fd);
}

CSS-Wide Keywords

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

The initial value is none. This means the browser uses the marker defined by list-style-type unless another image is specified.

Property Values

The property accepts image values and CSS-wide keywords.

Value Description
none Specifies that no image marker is used.
url() References an external image file to use as the marker.
<image> Accepts supported CSS image values, including gradients.
initial Resets the property to none.
inherit Uses the computed value from the parent element.
unset Uses the inherited value because the property is inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value none
Inherited Yes
Applies to List items
Computed value Specified image value or none, with URLs made absolute
Animation type Discrete
Percentages Not applicable
Primary purpose Replace list markers with images

The property is commonly declared on <ul> or <ol> elements so their list items inherit the same marker image.

How It Works

Browsers normally generate markers for list items. The list-style-image property replaces the ordinary marker with an image when that image can be displayed.

Default List

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

Without custom styling, an unordered list usually displays circular bullets.

Add an Image Marker

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

Each list item uses the specified image instead of its ordinary bullet.

Restore Standard Markers

ul {
  list-style-image: none;
}

The browser returns to the marker specified by list-style-type.

Important Consideration

The image affects marker appearance only. It does not change the list's HTML structure, item order, or semantic meaning.

none Value

The none value disables the image marker. It does not necessarily remove the list marker itself.

Use the Default Marker

ul {
  list-style-image: none;
}

Use Square Bullets

ul {
  list-style-type: square;
  list-style-image: none;
}

Remove All Markers

ul {
  list-style-type: none;
  list-style-image: none;
}

Important Consideration

list-style-image: none is different from list-style: none. The shorthand also resets the marker type and position.

url() Value

The url() function references an image resource to display as a list marker.

PNG Marker

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

SVG Marker

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

Absolute URL

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

Relative URL

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

Relative URLs in external stylesheets are resolved relative to the stylesheet's location, not the HTML document's location.

Quoted and Unquoted URLs

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

Both forms are valid when the URL satisfies CSS syntax requirements. Quoted URLs are often easier to maintain.

Important Consideration

If an image fails to load, the browser uses the marker defined by list-style-type. Provide a suitable fallback when a visible marker is important.

SVG Images

SVG images are useful for list markers because they can remain sharp at different display resolutions.

Basic SVG Marker

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

SVG with Fallback

.feature-list {
  list-style-type: disc;
  list-style-image: url("images/checkmark.svg");
}

Example SVG File

The following SVG can be saved as checkmark.svg and used in the examples above.

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
  <circle cx="8" cy="8" r="7" fill="#15803d"/>
  <path d="M4 8l2.5 2.5L12 5" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Important Consideration

Include appropriate intrinsic dimensions in the SVG when predictable marker sizing is needed. The CSS list-style-image property does not provide direct controls for setting the marker image's width or height.

Gradient Images

CSS gradients are image values and can be used with list-style-image.

Linear Gradient

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

Radial Gradient

ul {
  list-style-image: radial-gradient(circle, #2563eb, #93c5fd);
}

Gradient with Fallback

ul {
  list-style-type: disc;
  list-style-image: linear-gradient(90deg, #2563eb, #60a5fa);
}

Important Consideration

Gradients do not have intrinsic dimensions. Their marker appearance and sizing may be less predictable than a small image file with defined dimensions. For consistent results, SVG or PNG markers are often easier to control.

Fallback Markers

The list-style-type property provides a fallback marker when the image specified by list-style-image cannot be displayed.

Disc Fallback

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

Square Fallback

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

Decimal Fallback

ol {
  list-style-type: decimal;
  list-style-image: url("images/number-marker.svg");
}

No Fallback Marker

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

If the image fails, no marker type remains available.

Important Consideration

A fallback marker helps maintain visible list structure when images are blocked, missing, or unavailable.

Image Sizing

The list-style-image property does not accept width or height values for controlling marker dimensions.

Image with Intrinsic Dimensions

ul {
  list-style-image: url("images/bullet-16px.png");
}

The browser uses the image's intrinsic dimensions and the applicable marker sizing rules.

SVG with Defined Dimensions

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
  <circle cx="8" cy="8" r="6" fill="#2563eb"/>
</svg>

CSS Width Does Not Resize the Marker

li {
  width: 200px;
  list-style-image: url("images/bullet.svg");
}

The width declaration changes the list item's width, not the marker image's width.

Important Consideration

Prepare marker images at appropriate dimensions. If you need precise CSS control over icon width, height, or scaling, consider using a ::before pseudo-element instead.

Image Positioning

The list-style-position property determines whether the image marker appears inside or outside the list item's principal content box.

Outside Image Marker

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

Inside Image Marker

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

Adjust List Indentation

ul {
  list-style-image: url("images/checkmark.svg");
  list-style-position: outside;
  padding-left: 2rem;
}

Important Consideration

The list-style-position property controls general marker placement, but it does not provide precise horizontal or vertical offsets. Native marker alignment depends on the browser's list layout rules.

list-style Shorthand

The list-style shorthand combines list-style-type, list-style-position, and list-style-image.

Separate Properties

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

Equivalent Shorthand

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

Image and Position

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

Shorthand Reset Behavior

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

The second declaration resets list-style-image to none, removing the custom image.

Important Consideration

When a shorthand declaration follows a longhand declaration, omitted shorthand components are reset to their initial values.

Individual List Items

You can apply different marker images to individual list items instead of styling the entire list.

HTML Example

<ul class="status-list">
  <li class="complete">Completed</li>
  <li class="pending">Pending</li>
  <li class="review">Under Review</li>
</ul>

CSS Example

.status-list {
  list-style-type: disc;
}
.status-list .complete {
  list-style-image: url("images/complete.svg");
}
.status-list .pending {
  list-style-image: url("images/pending.svg");
}
.status-list .review {
  list-style-image: url("images/review.svg");
}

Target the First Item

.status-list li:first-child {
  list-style-image: url("images/star.svg");
}

Important Consideration

When marker images communicate item status, include the status in the text. A decorative marker alone should not carry essential meaning.

Nested Lists

Nested lists can use different image markers at each level.

HTML Example

<ul class="nested-image-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-image-list {
  list-style-type: disc;
  list-style-image: url("images/primary.svg");
}
.nested-image-list ul {
  list-style-type: circle;
  list-style-image: url("images/secondary.svg");
}

Restore Standard Markers at a Nested Level

.nested-image-list ul {
  list-style-image: none;
  list-style-type: circle;
}

Important Consideration

Because list-style-image is inherited, nested lists may reuse a parent marker image unless a more specific rule overrides it.

Custom Marker Alternatives

When native image markers do not provide enough styling control, CSS offers other techniques.

Using ::before

.custom-icon-list {
  list-style: none;
  padding-left: 0;
}
.custom-icon-list li {
  position: relative;
  padding-left: 28px;
}
.custom-icon-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 16px;
  height: 16px;
  background: url("images/checkmark.svg") center / contain no-repeat;
}

This approach allows direct control over marker dimensions and placement.

Using ::marker

.colored-list {
  list-style-type: disc;
}
.colored-list li::marker {
  color: #2563eb;
  font-size: 1.25em;
}

The ::marker pseudo-element can style supported marker properties, but it does not provide general background-image, width, or height controls.

Using a Background Image

.background-list {
  list-style: none;
  padding-left: 0;
}
.background-list li {
  padding-left: 28px;
  background: url("images/checkmark.svg") left 0.3em / 16px 16px no-repeat;
}

Important Consideration

Custom pseudo-element and background techniques provide greater layout control, but they require additional CSS and careful handling of text wrapping and list accessibility.

Inheritance

The list-style-image property is inherited. A marker image declared on a list container can therefore be used by its list items.

Parent List Declaration

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

Override a List Item

ul li.special {
  list-style-image: url("images/star.svg");
}

Explicit Inheritance

li {
  list-style-image: inherit;
}

Reset to Initial Value

li {
  list-style-image: initial;
}

This resets the property to none.

Important Consideration

Inheritance makes it convenient to style entire lists, but nested lists and individual items may need explicit overrides.

Accessibility

Custom image markers should enhance list presentation without replacing meaningful text or the semantic structure of HTML lists.

Use Semantic Lists

<ul class="feature-list">
  <li>Responsive Layout</li>
  <li>Accessible Navigation</li>
  <li>Semantic HTML</li>
</ul>

Provide a Fallback Marker

.feature-list {
  list-style-type: disc;
  list-style-image: url("images/checkmark.svg");
}

Do Not Rely Only on Images

If a marker indicates success, failure, or another important state, include that information in the list item's text.

Use Appropriate Image Contrast

Choose marker colors that remain distinguishable against the surrounding background.

Avoid Oversized Markers

Large marker images can disrupt line spacing and make list items harder to scan.

Preserve List Semantics

Using list-style-image does not remove list semantics. However, changing the list's display type or replacing its structure with unrelated elements may affect accessibility.

Important Consideration

Test custom markers with keyboard navigation, text resizing, and assistive technologies when they are used in important interface components.

list-style-image Example

This example compares an SVG image marker, a standard bullet marker, and an image marker positioned inside the list item. The SVG is embedded directly in the CSS as a data URL so the demonstration does not depend on an external image file.

HTML Example

<div class="list-image-demo">
  <div class="demo-item">
    <h3>SVG Image Marker</h3>
    <ul class="image-list">
      <li>HTML Elements</li>
      <li>CSS Properties</li>
      <li>JavaScript Basics</li>
    </ul>
  </div>
  <div class="demo-item">
    <h3>Standard Marker</h3>
    <ul class="standard-list">
      <li>HTML Elements</li>
      <li>CSS Properties</li>
      <li>JavaScript Basics</li>
    </ul>
  </div>
  <div class="demo-item">
    <h3>Inside Image Marker</h3>
    <ul class="inside-list">
      <li>HTML Elements</li>
      <li>CSS Properties</li>
      <li>JavaScript Basics</li>
    </ul>
  </div>
</div>

CSS Example

.list-image-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}
.list-image-demo .demo-item {
  padding: 15px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
}
.list-image-demo h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.list-image-demo ul {
  margin: 0;
  padding-left: 2rem;
}
.list-image-demo li {
  margin-bottom: 8px;
}
.list-image-demo .image-list,
.list-image-demo .inside-list {
  list-style-type: disc;
  list-style-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%2315803d'/%3E%3Cpath d='M4 8l2.5 2.5L12 5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E");
}
.list-image-demo .image-list {
  list-style-position: outside;
}
.list-image-demo .standard-list {
  list-style-type: disc;
  list-style-image: none;
}
.list-image-demo .inside-list {
  list-style-position: inside;
  padding-left: 0;
}
Browser Result

SVG Image Marker

  • HTML Elements
  • CSS Properties
  • JavaScript Basics

Standard Marker

  • HTML Elements
  • CSS Properties
  • JavaScript Basics

Inside Image Marker

  • HTML Elements
  • CSS Properties
  • JavaScript Basics

The first list displays green SVG checkmarks outside the content box. The second uses ordinary bullets, while the third displays the same SVG image markers inside the content box.

Remove the Image Marker

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

Change the Fallback Type

.list-image-demo .image-list {
  list-style-type: square;
}

If the SVG image becomes unavailable, the browser can display square markers instead.

Common Mistakes

Confusing list-style-image: none with list-style: none

The longhand removes only the image. The shorthand removes the marker type and image when set to none.

Using an Incorrect Image Path

Relative image paths in external CSS files are resolved relative to the stylesheet's location.

Expecting width and height to Resize the Marker

The list-style-image property does not provide direct image sizing controls.

Using Oversized Images

Large images can increase line box dimensions or disrupt the visual alignment of list items.

Forgetting Fallback Markers

When the image fails, the browser uses list-style-type. Avoid setting it to none if a visible fallback is needed.

Applying the Property to Non-List-Item Elements

The property affects marker boxes. Ordinary block elements do not generate list markers unless they use the list-item display type.

Assuming Image Position Can Be Precisely Controlled

The property does not accept horizontal or vertical offset values.

Overwriting the Image with the Shorthand

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

The shorthand resets the image to none.

Ignoring Inheritance

Nested lists may inherit image markers unless explicitly overridden.

Relying on Decorative Images for Meaning

Important information should also appear in text rather than being communicated only by marker images.

Using Images When Simple Markers Are Sufficient

Standard bullets and numbers are easier to maintain and do not require external resources.

Important Considerations

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

  • The property replaces ordinary list markers with images.
  • The initial value is none.
  • The property is inherited.
  • It applies to list items.
  • It accepts none or supported CSS image values.
  • The url() function is commonly used to reference marker images.
  • PNG, SVG, and other supported image formats can be used.
  • CSS gradients are also image values.
  • Image marker sizing depends on the image and applicable layout rules.
  • The property does not provide direct width or height controls.
  • Relative URLs in external stylesheets resolve relative to the CSS file.
  • The browser uses list-style-type when an image cannot be displayed.
  • Use a visible fallback marker when appropriate.
  • The none value removes only the image marker.
  • The list-style shorthand can reset the image value.
  • The list-style-position property controls inside or outside placement.
  • Native marker positioning does not provide precise offsets.
  • Margins and padding affect the space available for markers.
  • Image markers can be applied to individual list items.
  • Nested lists may inherit marker images.
  • SVG images can provide sharp markers at different resolutions.
  • Images with defined intrinsic dimensions are generally easier to manage.
  • Custom pseudo-elements can provide more precise sizing and positioning.
  • The ::marker pseudo-element supports only certain CSS properties.
  • Changing marker images does not change HTML list semantics.
  • Important information should not depend only on decorative marker images.
  • Test custom markers with different font sizes and responsive layouts.

Browser Support

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

Basic image markers using url() have long-established support. Support for particular CSS image functions and their behavior as list markers may vary by browser.

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

Specifications

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

CSS Lists and Counters Module Level 3: list-style-image

The specification defines how image values are used as list markers and how fallback marker types are handled.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: list-style-image