List Style Type

Utilities for controlling the bullet/number style of a list.

Default class reference

Class
Properties
list-nonelist-style-type: none;
list-disclist-style-type: disc;
list-decimallist-style-type: decimal;

Usage

To create bulleted or numeric lists, use the list-disc and list-decimal utilities.

List Style Type - 图1

  1. <ul class="list-disc">
  2. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  3. ...
  4. </ul>
  5. <ol class="list-decimal">
  6. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  7. ...
  8. </ol>
  9. <ul>
  10. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  11. ...
  12. </ul>

Responsive

To control the list style type of a list element at a specific breakpoint, add a {screen}: prefix to any existing list utility. For example, use .md:list-disc to apply the list-disc utility at only medium screen sizes and above.

  1. <ul class="list-none md:list-disc">
  2. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  3. <li>Assumenda, quia temporibus eveniet a libero incidunt suscipit</li>
  4. <li>Quidem, ipsam illum quis sed voluptatum quae eum fugit earum</li>
  5. </ul>

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Customizing

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.

  1. // tailwind.config.js
  2. module.exports = {
  3. theme: {
  4. listStyleType: {
  5. none: 'none',
  6. - disc: 'disc',
  7. - decimal: 'decimal',
  8. + square: 'square',
  9. + roman: 'upper-roman',
  10. }
  11. }
  12. }

Variants

By default, only responsive variants are generated for list style type utilities.

You can control which variants are generated for the list style type utilities by modifying the listStyleType property in the variants section of your tailwind.config.js file.

For example, this config will also generate hover and focus variants:

  1. // tailwind.config.js
  2. module.exports = {
  3. variants: {
  4. extend: {
  5. // ...
  6. + listStyleType: ['hover', 'focus'],
  7. }
  8. }
  9. }

Disabling

If you don’t plan to use the list style type utilities in your project, you can disable them entirely by setting the listStyleType property to false in the corePlugins section of your config file:

  1. // tailwind.config.js
  2. module.exports = {
  3. corePlugins: {
  4. // ...
  5. + listStyleType: false,
  6. }
  7. }

←Line Height List Style Position→

Edit this page on GitHub