row-gap, column-gap

Separate properties for spacing between rows and columns in grid layout.

Time to read: less than 5 min

Briefly

They set the spacing between rows and columns in grid layout.

Example

        
          
          .container {  display: grid;  grid-template-columns: 1fr 350px 1fr;  grid-template-rows: repeat(3, 150px);  /* Spacing between rows */  row-gap: 50px;  /* Spacing between columns */  column-gap: 20px;}
          .container {
  display: grid;
  grid-template-columns: 1fr 350px 1fr;
  grid-template-rows: repeat(3, 150px);
  /* Spacing between rows */
  row-gap: 50px;
  /* Spacing between columns */
  column-gap: 20px;
}

        
        
          
        
      
Example of implementing row-gap and column-gap properties

How it is written

Specify a single size value in any unit of measurement.

Tips

💡 In the inspector, the spacing is shaded, so it can be distinguished from grid elements.

Поддержка в браузерах:
  • Chrome 66, поддерживается
  • Edge 79, поддерживается
  • Firefox 76, поддерживается
  • Safari 12.1, поддерживается
О Baseline