Typography

List Style Image

Utilities for controlling the marker images for list items.

Quick reference

Class
Properties
list-image-nonelist-style-image: none;

Basic usage

Setting the list style image

Control the marker image for list items using the list-image-{value} utilities.

Out of the box, list-image-none is the only available preconfigured list style image utility. And while you can add additional utilities by customizing your theme, you can also use the square bracket notation to generate an arbitrary value on the fly.

List Style Image - 图1

  1. <ul class="list-image-[url(checkmark.png)] ...">
  2. <li>5 cups chopped Porcini mushrooms</li>
  3. <!-- ... -->
  4. </ul>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:list-image-[url(checkmark.png)] to only apply the list-image-[url(checkmark.png)] utility on hover.

  1. <ul class="list-image-none hover:list-image-[url(checkmark.png)]">
  2. <!-- ... -->
  3. </ul>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:list-image-[url(checkmark.png)] to apply the list-image-[url(checkmark.png)] utility at only medium screen sizes and above.

  1. <ul class="list-image-none md:list-image-[url(checkmark.png)]">
  2. <!-- ... -->
  3. </ul>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.


Using custom values

Customizing your theme

By default, Tailwind only provides the list-image-none utility. You can customize these values by editing theme.listStyleImage or theme.extend.listStyleImage in your tailwind.config.js file.

tailwind.config.js

  1. module.exports = {
  2. theme: {
  3. extend: {
  4. listStyleImage: {
  5. checkmark: 'url("/img/checkmark.png")',
  6. },
  7. }
  8. }
  9. }

Learn more about customizing the default theme in the theme customization documentation.

Arbitrary values

If you need to use a one-off list-image value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

  1. <ul class="list-image-[url(checkmark.png)]">
  2. <!-- ... -->
  3. </ul>

Learn more about arbitrary value support in the arbitrary values documentation.