MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

Gutters

Gutters or alleys are spacing between content tracks. These can be created in CSS Grid Layout using the grid-column-gap, grid-row-gap, or grid-gap properties.

In the example below we have a three-column and two-row track grid, with 20-pixel gaps between column tracks and 1em-gaps between row tracks.

.wrapper {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  grid-auto-rows: 100px;
  grid-column-gap: 20px;
  grid-row-gap: 1em;
}
<div class="wrapper">
   <div>One</div>
   <div>Two</div>
   <div>Three</div>
   <div>Four</div>
   <div>Five</div>
</div>

In terms of grid sizing, gaps act as if they were a regular grid track however nothing can be placed into the gap. The gap acts as if the grid line at that location has gained extra size, so any grid item placed after that line begins at the end of the gap.

The grid-gap properties are not the only thing that can cause tracks to space out. Margins, padding or the use of the space distribution properties in Box Alignment can all contribute to the visible gap – therefore the grid-gap properties should not be seen as equal to “the gutter size” unless you know that your design has not introduced any additional space with one of these methods.

Learn More

Property reference

Further reading

Document Tags and Contributors

Tags: 
 Contributors to this page: teoli, rachelandrew
 Last updated by: teoli,