Gap

Utilities for controlling gutters between grid rows and columns.

Class reference

Class Properties
.gap-0 gap: 0;
.gap-1 gap: 0.25rem;
.gap-2 gap: 0.5rem;
.gap-3 gap: 0.75rem;
.gap-4 gap: 1rem;
.gap-5 gap: 1.25rem;
.gap-6 gap: 1.5rem;
.gap-8 gap: 2rem;
.gap-10 gap: 2.5rem;
.gap-12 gap: 3rem;
.gap-16 gap: 4rem;
.gap-20 gap: 5rem;
.gap-24 gap: 6rem;
.gap-32 gap: 8rem;
.gap-40 gap: 10rem;
.gap-48 gap: 12rem;
.gap-56 gap: 14rem;
.gap-64 gap: 16rem;
.gap-px gap: 1px;
.row-gap-0 row-gap: 0;
.row-gap-1 row-gap: 0.25rem;
.row-gap-2 row-gap: 0.5rem;
.row-gap-3 row-gap: 0.75rem;
.row-gap-4 row-gap: 1rem;
.row-gap-5 row-gap: 1.25rem;
.row-gap-6 row-gap: 1.5rem;
.row-gap-8 row-gap: 2rem;
.row-gap-10 row-gap: 2.5rem;
.row-gap-12 row-gap: 3rem;
.row-gap-16 row-gap: 4rem;
.row-gap-20 row-gap: 5rem;
.row-gap-24 row-gap: 6rem;
.row-gap-32 row-gap: 8rem;
.row-gap-40 row-gap: 10rem;
.row-gap-48 row-gap: 12rem;
.row-gap-56 row-gap: 14rem;
.row-gap-64 row-gap: 16rem;
.row-gap-px row-gap: 1px;
.col-gap-0 column-gap: 0;
.col-gap-1 column-gap: 0.25rem;
.col-gap-2 column-gap: 0.5rem;
.col-gap-3 column-gap: 0.75rem;
.col-gap-4 column-gap: 1rem;
.col-gap-5 column-gap: 1.25rem;
.col-gap-6 column-gap: 1.5rem;
.col-gap-8 column-gap: 2rem;
.col-gap-10 column-gap: 2.5rem;
.col-gap-12 column-gap: 3rem;
.col-gap-16 column-gap: 4rem;
.col-gap-20 column-gap: 5rem;
.col-gap-24 column-gap: 6rem;
.col-gap-32 column-gap: 8rem;
.col-gap-40 column-gap: 10rem;
.col-gap-48 column-gap: 12rem;
.col-gap-56 column-gap: 14rem;
.col-gap-64 column-gap: 16rem;
.col-gap-px column-gap: 1px;

Gap

Use .gap-{size} to change the gutter size in grid layouts.

gap-1
gap-2
gap-6
<div class="grid gap-1 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid gap-2 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid gap-6 grid-cols-2">
  <!-- ... -->
</div>

Row Gap

Use .row-gap-{size} to change the gutter size between rows in grid layouts.

row-gap-1
row-gap-2
row-gap-6
<div class="grid row-gap-1 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid row-gap-2 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid row-gap-6 grid-cols-2">
  <!-- ... -->
</div>

Column Gap

Use .col-gap-{size} to change the gutter size between columns in grid layouts.

col-gap-1
col-gap-2
col-gap-6
<div class="grid col-gap-1 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid col-gap-2 grid-cols-2">
  <!-- ... -->
</div>

<div class="grid col-gap-6 grid-cols-2">
  <!-- ... -->
</div>

Responsive

To control the gap at a specific breakpoint, add a {screen}: prefix to any existing gap utility. For example, use md:gap-6 to apply the gap-6 utility at only medium screen sizes and above.

<div class="grid gap-4 sm:gap-6 md:gap-8 lg:gap-12 xl:gap-16 ...">
  <!-- ... -->
</div>

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

Customizing

Gap values

By default Tailwind's gap scale matches your configured spacing scale.

You can customize the global spacing scale in the theme.spacing or theme.extend.spacing sections of your tailwind.config.js file:

// tailwind.config.js
module.exports = {
theme: {
extend: {
spacing: {
+       '72': '18rem',
+       '84': '21rem',
+       '96': '24rem',
}
}
}
}

To customize the gap scale separately, use the gap section of your Tailwind theme config.

// tailwind.config.js
module.exports = {
theme: {
extend: {
gap: {
+       '11': '2.75rem',
+       '13': '3.25rem',
}
}
}
}

Learn more about customizing the default theme in the theme customization documentation.

Responsive and pseudo-class variants

By default, no responsive, hover, focus, active, or group-hover variants are generated for gap utilities.

You can control which variants are generated for the gap utilities by modifying the gap property in the variants section of your tailwind.config.js file.

For example, this config will generate responsive and hover variants:

// tailwind.config.js
module.exports = {
variants: {
    // ...
-   gap: [''],
+   gap: ['responsive', 'hover'],
}
}