Lists
list-style-image
list-style-image uses an image instead of a bullet or number as the marker at the start of each list item. If the image cannot be loaded, the list-style-type marker is shown instead.
Syntax
<image> | nonePreview
りんご
Banana
みかん
Presets
Drag the bottom-right corner to resize
Code
.box {
list-style-image: url(/marker-star.svg);
}Controls
list-style-imageurl(/marker-star.svg)
りんご
Banana
みかん
About
What the values mean
none: the initial value. No image; thelist-style-typemarker is shown.url(/marker-star.svg): uses that image as the marker.
In the preview, the three rows inside the box (display: list-item) inherit the value set on the box. This site only lets you pick the star, check, and arrow images it hosts.
When to use it
Use it to show icons instead of bullets, for example in checklists or step lists.
Watch out
- An image with its own width and height is drawn at that size and does not scale with the text. The images in the preview are 12px square. When you need control over size or position, drawing it with
background-imageon::beforeis a common approach. - Setting
list-style-typeas well is a good fallback in case the image fails to load. - It is inherited, so setting it on a
ulapplies to everyliinside. Only elements withdisplay: list-itemget a marker.