排版
Utilities for controlling the bullet/number style of a list.
To create bulleted or numeric lists, use the list-disc
and list-decimal
utilities.
<ul class="list-disc">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ul>
<ol class="list-decimal">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ol>
<ul class="list-none">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ul>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:list-disc
to only apply the list-disc
utility on hover.
<ul class="list-none hover:list-disc">
<!-- ... -->
</ul>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
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-disc
to apply the list-disc
utility at only medium screen sizes and above.
<ul class="list-none md:list-disc">
<!-- ... -->
</ul>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
By default, Tailwind provides three utilities for the most common list style types. You change, add, or remove these by editing the theme.listStyleType
section of your Tailwind config.
module.exports = {
theme: {
listStyleType: {
none: 'none',
disc: 'disc',
decimal: 'decimal',
square: 'square',
roman: 'upper-roman',
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
If you need to use a one-off list-style-type
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.
<ul class="list-[upper-roman]">
<!-- ... -->
</ul>
Learn more about arbitrary value support in the arbitrary values documentation.