List Style Position

Utilities for controlling the position of bullets/numbers in lists.

Default class reference

Class
Properties
list-insidelist-style-position: inside;
list-outsidelist-style-position: outside;

Usage

Control the position of the markers and text indentation in a list using the list-inside and list-outside utilities.

List Style Position - 图1

  1. <ul class="list-inside bg-rose-200 ...">
  2. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  3. ...
  4. </ul>
  5. <ul class="list-outside bg-rose-200 ...">
  6. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  7. ...
  8. </ul>

Responsive

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

  1. <ul class="list-outside md:list-inside">
  2. <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit</li>
  3. <!-- ... -->
  4. </ul>

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

Customizing

Variants

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

You can control which variants are generated for the list style position utilities by modifying the listStylePosition 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. + listStylePosition: ['hover', 'focus'],
  7. }
  8. }
  9. }

Disabling

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

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

←List Style Type Placeholder Color→

Edit this page on GitHub