Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Flexbox

The column-gap property

Reference for the CSS column-gap property: set the space between columns in grid, flexbox and multi-column text layouts, with live examples and usage notes.

The column-gap property sets the space between columns. It works in three layouts: between column tracks in a grid, between items on the same line in a flex container, and between the columns of multi-column text. It is one half of the gap shorthand, together with row-gap.

CSS
.cards { display: flex; column-gap: 1rem; }
.article { column-count: 2; column-gap: 2rem; }

Try it

Column gap in grid and multi-column text

Syntax

CSS
column-gap: normal | <length-percentage>;
  • Initial value: normal
  • Applies to: multi-column containers, flex containers and grid containers
  • Inherited: no
  • Animatable: yes, as a length or percentage
  • Computed value: as specified, with lengths made absolute

Values

Value Description
<length> A non-negative length such as 2rem or 24px.
<percentage> A percentage of the container's content-box width.
normal 1em in multi-column layout; no gap in grid and flex layout.

Usage notes

  • Different defaults. Multi-column text has a built-in 1em gap because normal means 1em there. Grid and flex containers start with no gap, so you must set one.
  • Column rules. A column-rule is drawn centered in the gap, so the gap must be wide enough to hold the line.
  • Flexbox. The gap goes between items on a line and is not added at the line edges. It does not collapse and does not replace margin on the container.
  • Equal tracks. In a grid with 1fr columns, gaps are subtracted first, then the rest is shared among the columns.
  • Old name. grid-column-gap is an alias from early grid drafts; use column-gap.

Browser support

Supported in all current browsers for multi-column, grid and flexbox layouts.