Border Style

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

Default 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-light-blue-500 ..."></div>
  2. <div class="border-dashed border-4 border-light-blue-500 ..."></div>
  3. <div class="border-dotted border-4 border-light-blue-500 ..."></div>
  4. <div class="border-double border-4 border-light-blue-500 ..."></div>
  5. <div class="border-none border-4 border-light-blue-500 ..."></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.

  1. <div class="border-solid md:border-dotted ..."></div>

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 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. extend: {
  5. // ...
  6. + borderStyle: ['hover', 'focus'],
  7. }
  8. }
  9. }

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→