Border Width
@include('_partials.class-table', [ 'rows' => [ [ '.border', 'border-width: 1px;', ], [ '.border-0', 'border-width: 0;', ], [ '.border-2', 'border-width: 2px;', ], [ '.border-4', 'border-width: 4px;', ], [ '.border-8', 'border-width: 8px;', ], [ '.border-t', 'border-top-width: 1px;', ], [ '.border-r', 'border-right-width: 1px;', ], [ '.border-b', 'border-bottom-width: 1px;', ], [ '.border-l', 'border-left-width: 1px;', ], [ '.border-t-0', 'border-top-width: 0;', ], [ '.border-r-0', 'border-right-width: 0;', ], [ '.border-b-0', 'border-bottom-width: 0;', ], [ '.border-l-0', 'border-left-width: 0;', ], [ '.border-t-2', 'border-top-width: 2px;', ], [ '.border-r-2', 'border-right-width: 2px;', ], [ '.border-b-2', 'border-bottom-width: 2px;', ], [ '.border-l-2', 'border-left-width: 2px;', ], [ '.border-t-4', 'border-top-width: 4px;', ], [ '.border-r-4', 'border-right-width: 4px;', ], [ '.border-b-4', 'border-bottom-width: 4px;', ], [ '.border-l-4', 'border-left-width: 4px;', ], [ '.border-t-8', 'border-top-width: 8px;', ], [ '.border-r-8', 'border-right-width: 8px;', ], [ '.border-b-8', 'border-bottom-width: 8px;', ], [ '.border-l-8', 'border-left-width: 8px;', ], ] ])
All sides
Use the .border
, .border-0
, .border-2
, .border-4
, or .border-8
utilities to set the border width for all sides of an element.
@component('_partials.code-sample')
.border-0
.border
.border-2
.border-4
.border-8
Individual sides
Use the .border-{side}
, .border-{side}-0
, .border-{side}-2
, .border-{side}-4
, or .border-{side}-8
utilities to set the border width for one side of an element.
@component('_partials.code-sample')
.border-t-2
.border-r-2
.border-b-2
.border-l-2
Between elementsv1.3.0+
You can also add borders between child elements using the divide-{x/y}-{width}
and divide-{color}
utilities.
Learn more in the Divide Width and Divide Color documentation.
@component('_partials.code-sample')
@slot('code')
Responsive
To control the border width of an element at a specific breakpoint, add a {screen}:
prefix to any existing border width utility. For example, use md:border-t-4
to apply the border-t-4
utility at only medium screen sizes and above.
For more information about Tailwind's responsive design features, check out the Responsive Design documentation.
@component('_partials.responsive-code-sample', ['class' => 'text-center']) @slot('none')
@endslot @slot('sm')@endslot @slot('md')@endslot @slot('lg')@endslot @slot('xl')@endslot @slot('code')@endslot @endcomponentCustomizing
Border Widths
By default Tailwind provides five border-width
utilities, and the same number of utilities per side (top, right, bottom, and left). You change, add, or remove these by editing the theme.borderWidth
section of your Tailwind config. The values in this section will also control which utilities will be generated side.
@component('_partials.customized-config', ['key' => 'theme.borderWidth']) default: '1px', '0': '0', '2': '2px',
- '3': '3px', '4': '4px',
- '6': '6px',
- '8': '8px', @endcomponent
@include('_partials.variants-and-disabling', [ 'utility' => [ 'name' => 'border width', 'property' => 'borderWidth', ], 'variants' => [ 'responsive', ], ])