Class reference

Border Color - 图1

Usage

Control the border color of an element using the .border-{color} utilities.

Border Color - 图2

Responsive

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

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

Border Color - 图3

all

Border Color - 图4

sm

Border Color - 图5

md

Border Color - 图6

lg

Border Color - 图7

xl

Border Color - 图8

Hover

To control the border color of an element on hover, add the hover: prefix to any existing border color utility. For example, use hover:border-blue to apply the border-blue utility on hover.

Border Color - 图9

Hover utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the focus: prefix.

  1. <button class="... md:border-blue md:hover:border-blue-dark ...">Button</button>

Focus

To control the border color of an element on focus, add the focus: prefix to any existing border color utility. For example, use focus:border-blue to apply the border-blue utility on focus.

Border Color - 图10

Focus utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the focus: prefix.

  1. <input class="... md:border-grey-lighter md:focus:border-white ...">

Customizing

Border Colors

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

You can customize your color palette by editing the colors variable in your Tailwind config file, or customize just your border colors using the borderColors section of your Tailwind config.

Border Color - 图11

Responsive and State Variants

By default, only responsive, hover and focus variants are generated for border color utilities.

You can control which variants are generated for the border color utilities by modifying the borderColors property in the modules section of your Tailwind config file.

For example, this config will also generate variants:

Border Color - 图12

Disabling

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

Border Color - 图13