list-style-image

Class Description

list-image

Replaces the list marker with an image via list-style-image.

CSS Rules

.list-image {
  list-style-image: var(--list-image);
}

Usage

The .list-image class is flagged as a value-driven selector. The variable --list-image is required.
<element class="list-image" style="--list-image: /* value */;" />

Responsive

Prefix .list-image utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:list-image" style="--md-list-image: /* value */;" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="list-image:hover" style="--list-image-hover: /* value */;" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="list-image:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before list-image::before" style="--list-image-before: /* value */;" />

<element class="content-after list-image::after" style="--list-image-after: /* value */;" />

Shorthand

Value-driven classes support a shorthand syntax like bg=pink or p=4. The runtime processes this for you. Unlike :hover that is generating CSS on the fly, shorthand only splits it and appends the corresponding style.

<!-- Input -->
<element class="list-image=value" />

<!-- Output -->
<element class="list-image" style="--list-image: value;" />

CLS Alert

This feature may cause CLS (Cumulative Layout Shift). Make sure to include a z-not-ready class in your <head> tag.

.list-image Replaces the list marker with an image via list-style-image.

list-image-none

Removes any custom list marker image by setting list-style-image to none.

CSS Rules

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

Usage

<element class="list-image-none" />

Responsive

Prefix .list-image-none utility with a breakpoint variant (e.g., md:) to apply styles at specific screen sizes (Supported breakpoints are xm through 2xl).

<element class="md:list-image-none" />

States

States are generated dynamically at runtime and always come last. Append a state like :hover or :focus to the end of the class. This works in conjunction with breakpoints .

Supported pseudo-classes: :hover, :active, :focus, :focus-visible, :focus-within, :target, :checked, :disabled, and :group-hover.

<element class="list-image-none:hover" />

Group Hover Example

The :group-hover state applies styles when a parent element with the .group class is hovered.

<element class="group">
  <element class="list-image-none:group-hover">...</element>
</element>

Pseudo-Elements

The ::before and ::after utility classes are supported too. Granted that you add the mandatory content-before or content-after class in order for them to work.

<element class="content-before list-image-none::before" />

<element class="content-after list-image-none::after" />
.list-image-none Removes any custom list marker image by setting list-style-image to none.