1. Tables
  2. border-spacing

Tables

border-spacing

Handy classes for dialing in the gap between table borders.

ClassStyles
border-spacing-<number>
border-spacing: calc(var(--spacing) * <number>);
border-spacing-(<custom-property>)
border-spacing: var(<custom-property>);
border-spacing-[<value>]
border-spacing: <value>;
border-spacing-x-<number>
border-spacing: calc(var(--spacing) * <number>) var(--tw-border-spacing-y);
border-spacing-x-(<custom-property>)
border-spacing: var(<custom-property>) var(--tw-border-spacing-y);
border-spacing-x-[<value>]
border-spacing: <value> var(--tw-border-spacing-y);
border-spacing-y-<number>
border-spacing: var(--tw-border-spacing-x) calc(var(--spacing) * <number>);
border-spacing-y-(<custom-property>)
border-spacing: var(--tw-border-spacing-x) var(<custom-property>);
border-spacing-y-[<value>]
border-spacing: var(--tw-border-spacing-x) <value>;

Examples

Basic example

Use border-spacing-<number> utilities like border-spacing-2 and border-spacing-x-3 to manage the gap sitting between the borders of table cells with separate borders:

StateCity
IndianaIndianapolis
OhioColumbus
MichiganDetroit
<table class="border-separate border-spacing-2 border border-gray-400 dark:border-gray-500">  <thead>    <tr>      <th class="border border-gray-300 dark:border-gray-600">State</th>      <th class="border border-gray-300 dark:border-gray-600">City</th>    </tr>  </thead>  <tbody>    <tr>      <td class="border border-gray-300 dark:border-gray-700">Indiana</td>      <td class="border border-gray-300 dark:border-gray-700">Indianapolis</td>    </tr>    <tr>      <td class="border border-gray-300 dark:border-gray-700">Ohio</td>      <td class="border border-gray-300 dark:border-gray-700">Columbus</td>    </tr>    <tr>      <td class="border border-gray-300 dark:border-gray-700">Michigan</td>      <td class="border border-gray-300 dark:border-gray-700">Detroit</td>    </tr>  </tbody></table>

Using a custom value

Reach for the border-spacing-[<value>] syntax whenever you want to define the border spacing from a fully custom value:

<table class="border-spacing-[7px] ...">  <!-- ... --></table>

Working with CSS variables? The border-spacing-(<custom-property>) syntax works here too:

<table class="border-spacing-(--my-border-spacing) ...">  <!-- ... --></table>

Think of this as a convenient shorthand for border-spacing-[var(<custom-property>)] that wires in the var() function on your behalf.

Responsive design

Add a breakpoint variant such as md: in front of any border-spacing utility so it kicks in only at medium screen sizes and up:

<table class="border-spacing-2 md:border-spacing-4 ...">  <!-- ... --></table>

Find out more about variants over in the variants documentation.

Customizing your theme

The border-spacing-<number> utilities are powered by the --spacing theme variable, which you can tailor within your own theme:

@theme {  --spacing: 1px; }

Read up on tailoring the spacing scale over in the theme variable documentation.

Copyright © 2026 Breezel, Inc.·Trademark Policy