Gap
v1.2.0+
Utilities for controlling gutters between grid rows and columns.
Gap
Use to change the gutter size in grid layouts.
Use .gap-y-{size}
to change the gutter size between rows in grid layouts.
<div class="grid gap-y-1 grid-cols-2">
<!-- ... -->
</div>
<!-- ... -->
</div>
<div class="grid gap-y-6 grid-cols-2">
<!-- ... -->
</div>
Column Gap
Use .gap-x-{size}
to change the gutter size between columns in grid layouts.
Note that prior to Tailwind v1.7.0, these utilities were named .col-gap-{size}
. For more information, see the upcoming changes guide.
To control the gap at a specific breakpoint, add a 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 documentation.
Customizing
By default Tailwind’s gap scale matches your configured .
To customize the gap scale separately, use the gap
section of your Tailwind theme config.
// tailwind.config.js
module.exports = {
theme: {
extend: {
+ '11': '2.75rem',
}
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
By default, only responsive 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 also generate hover and focus variants:
If you don’t plan to use the gap utilities in your project, you can disable them entirely by setting the gap
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ gap: false,
}