1. Borders
  2. border-width

Borders

border-width

Handy classes for setting how thick an element's borders appear.

ClassStyles
border
border-width: 1px;
border-<number>
border-width: <number> px;
border-(length: <custom-property>)
border-width: var(<custom-property>);
border-[<value>]
border-width: <value>;
border-x
border-inline-width: 1px;
border-x-<number>
border-inline-width: <number> px;
border-x-(length: <custom-property>)
border-inline-width: var(<custom-property>);
border-x-[<value>]
border-inline-width: <value>;
border-y
border-block-width: 1px;
border-y-<number>
border-block-width: <number> px;

Examples

Basic usage

Reach for border or a border-<number> utility such as border-2 and border-4 to give every side of an element the same border width:

border

border-2

border-4

border-8

<div class="border border-indigo-600 ..."></div><div class="border-2 border-indigo-600 ..."></div><div class="border-4 border-indigo-600 ..."></div><div class="border-8 border-indigo-600 ..."></div>

One side at a time

Reach for utilities such as border-r and border-t-4 to add a border to just one side of an element:

border-t-4

border-r-4

border-b-4

border-l-4

<div class="border-t-4 border-indigo-500 ..."></div><div class="border-r-4 border-indigo-500 ..."></div><div class="border-b-4 border-indigo-500 ..."></div><div class="border-l-4 border-indigo-500 ..."></div>

Horizontal or vertical pairs

Reach for utilities such as border-x and border-y-4 to set the border width across two sides of an element in a single class:

border-x-4

border-y-4

<div class="border-x-4 border-indigo-500 ..."></div><div class="border-y-4 border-indigo-500 ..."></div>

With logical properties

Use classes such as border-s and border-e-4 to set the border-inline-start-width border-inline-end-width border-inline-end-width logical properties, which resolve to either the left or right border depending on the text direction:

Left-to-right

Right-to-left

<div dir="ltr">  <div class="border-s-4 ..."></div></div><div dir="rtl">  <div class="border-s-4 ..."></div></div>

Reach for the border-bs-<number> and border-be-<number> utilities to apply the border-block-start-width and border-block-end-width logical properties, which resolve to either the top or bottom border depending on the writing mode:

<div class="border-bs-4 ..."></div>

Dividing children

Reach for utilities such as divide-x and divide-y-4 to place borders between child elements:

01
02
03
<div class="grid grid-cols-3 divide-x-4">  <div>01</div>  <div>02</div>  <div>03</div></div>

When children are reversed

When your elements sit in reverse order (using say flex-row-reverse or flex-col-reverse), reach for the divide-x-reverse or divide-y-reverse utilities so the border lands on the correct side of each element:

01
02
03
<div class="flex flex-col-reverse divide-y-4 divide-y-reverse divide-gray-200">  <div>01</div>  <div>02</div>  <div>03</div></div>

With a custom value

Reach for the border-[<value>] syntax when you want to base the border width on a fully custom value:

<div class="border-[2vw] ...">  <!-- ... --></div>

When working with CSS variables, the border-(length: <custom-property>) syntax also works:

<div class="border-(length:--my-border-width) ...">  <!-- ... --></div>

This simply acts as a shorthand for border-[length: var(<custom-property>)] and wires up the var() function on your behalf.

Responsive behavior

Add a breakpoint variant such as md: in front of a border-width utility to apply it only from medium screens upward:

<div class="border-2 md:border-t-4 ...">  <!-- ... --></div>

Read more on working with variants in the variant reference guide.

Copyright © 2026 Breezel, Inc.·Trademark Policy