Border Style

Utilities for controlling the style of an element’s borders.

Class reference

Class
Properties
.border-solidborder-style: solid;
.border-dashedborder-style: dashed;
.border-dottedborder-style: dotted;
.border-doubleborder-style: double;
.border-noneborder-style: none;

Usage

Use .border-{style} to control an element’s border style.

Border Style - 图1

  1. <div class="border-solid border-4 border-gray-600 ..."></div>
  2. <div class="border-dashed border-4 border-gray-600 ..."></div>
  3. <div class="border-dotted border-4 border-gray-600 ..."></div>
  4. <div class="border-double border-4 border-gray-600 ..."></div>
  5. <div class="border-none border-4 border-gray-600 ..."></div>

Responsive

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

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

Border Style - 图2

all

Border Style - 图3

sm

Border Style - 图4

md

Border Style - 图5

lg

Border Style - 图6

xl

  1. <div class="border-solid sm:border-dashed md:border-dotted lg:border-double xl:border-none">
  2. </div>

Customizing

Responsive and pseudo-class variants

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

You can control which variants are generated for the border style utilities by modifying the borderStyle 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. // ...
  5. - borderStyle: ['responsive'],
  6. + borderStyle: ['responsive', 'hover', 'focus'],
  7. }
  8. }

Disabling

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

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

← Border Opacity   Divide Width →