The grid-column-gap property controls the horizontal space between columns in a CSS grid layout.
01
Column gap
Horizontal.
02
0 default
No space.
03
px / rem
Length units.
04
Container
Grid parent.
05
column-gap
Modern alias.
06
Between only
Not edges.
Fundamentals
Introduction
The grid-column-gap property in CSS is used to define the space (or gap) between the columns in a grid layout. This property helps in creating a visually appealing and organized structure for grid-based layouts by ensuring consistent spacing between columns.
Definition and Usage
Set grid-column-gap on a grid container with display: grid. It adds space only between column tracks, not on the outer left or right edges of the grid. For modern projects, column-gap is the standard name, but grid-column-gap behaves the same way in grid layouts.
💡
Beginner Tip
Use grid-column-gap when you want horizontal spacing only. If you need both row and column spacing, use the gap shorthand instead.
Foundation
📝 Syntax
The syntax for the grid-column-gap property is simple and accepts a length value:
syntax.css
.container{grid-column-gap:value;}
Here, value can be any valid CSS length unit, such as px, em, %, rem, etc.
Wider column gap and tighter row gap create a layout that reads clearly across rows while keeping vertical rhythm compact.
A11y
♿ Accessibility
Use adequate gap so clickable items are not too close together on touch screens.
Prefer rem units so spacing scales with user font preferences.
Do not rely on gap alone for visual grouping; use headings and landmarks.
Test zoom levels to ensure gaps remain readable at 200% zoom.
Keep contrast between items and background clear even with spacing.
🧠 How grid-column-gap Works
1
Grid columns are defined
grid-template-columns creates the column tracks.
Template
2
grid-column-gap is set
You choose the horizontal space between adjacent columns.
Gap
3
Browser inserts gutters
Empty space appears between column tracks, not on the outer edges.
Spacing
=
▦
Cleaner column layout
Items stay aligned with consistent horizontal spacing between them.
Compatibility
🖥 Browser Compatibility
The grid-column-gap property is well-supported in modern browsers, including recent versions of Chrome, Firefox, Safari, Edge, and Opera.
✓ Baseline · Modern browsers
grid-column-gap everywhere
Column gap in grid layouts works in all major modern browsers.
97%Modern browser support
Google Chrome57+ · Desktop & Mobile
Full support
Mozilla Firefox52+ · Desktop & Mobile
Full support
Apple Safari10.1+ · macOS & iOS
Full support
Microsoft Edge16+ · 79+ Chromium
Full support
Opera44+
Full support
grid-column-gap property97% supported
Bottom line: Safe for modern projects. Prefer column-gap in new code; both work in grid layouts.
Wrap Up
🎉 Conclusion
The grid-column-gap property is an essential tool for web developers working with grid layouts. By specifying the space between columns, you can create a more organized and visually pleasing layout.
Experiment with different gap values to see how they can enhance the design and usability of your grid-based web projects. For new code, consider using column-gap or the gap shorthand alongside this legacy property name.