Divide Color

    v1.3.0+

    Utilities for controlling the border color between elements.

    Control the border color between elements using the utilities.

    Control the opacity of borders between elements using the .divide-opacity-{amount} utilities.

    Divide Color - 图2

    1. <div class="divide-y-4 divide-black divide-opacity-25">
    2. <div class="text-center py-2">2</div>
    3. <div class="text-center py-2">3</div>
    4. </div>

    Learn more in the divide opacity documentation.


    To control the borders between elements at a specific breakpoint, add a {screen}: prefix to any existing divide utility. For example, adding the class md:divide-x-8 to an element would apply the divide-x-8 utility at medium screen sizes and above.

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

    all

    sm

    Divide Color - 图5

    md

    lg

    Divide Color - 图7

    xl

    2

    3


    By default Tailwind makes the entire default color palette available as divide colors.

    You can by editing the theme.colors section of your tailwind.config.js file, customize just your border and divide colors together using the section, or customize only the divide colors using the theme.divideColor section.

    1. // tailwind.config.js
    2. module.exports = {
    3. theme: {
    4. divideColor: theme => ({
    5. - ...theme('borderColors'),
    6. + 'primary': '#3490dc',
    7. + 'danger': '#e3342f',
    8. })
    9. }

    By default, only responsive variants are generated for divide color utilities.

    You can control which variants are generated for the divide color utilities by modifying the divideColor property in the variants section of your tailwind.config.js file.

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

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

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

    ← Divide Width