You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!

A propriedade CSS grid-gap é uma propriedade de taquigrafia para grid-row-gap e grid-column-gap especificando os canais entre as linhas de grelha e as colunas.

/* One <length> value */
grid-gap: 20px;
grid-gap: 1em;
grid-gap: 3vmin;
grid-gap: 0.5cm;

/* One <percentage> value */
grid-gap: 16%;
grid-gap: 100%;

/* Two <length> values */
grid-gap: 20px 10px;
grid-gap: 1em 0.5em;
grid-gap: 3vmin 2vmax;
grid-gap: 0.5cm 2mm;

/* One or two <percentage> values */
grid-gap: 16% 100%;
grid-gap: 21px 82%;

/* Global values */
grid-gap: inherit;
grid-gap: initial;
grid-gap: unset;
Initial valueas each of the properties of the shorthand:
Applies togrid containers
Computed valueas each of the properties of the shorthand:
Animation typeas each of the properties of the shorthand:
Canonical orderthe unique non-ambiguous order defined by the formal grammar


This property is specified as a value for <'grid-row-gap'> followed optionally by a value for <'grid-column-gap'>. If <'grid-column-gap'> is omitted, it’s set to the same value as <'grid-row-gap'>.

<'grid-row-gap'> and <'grid-column-gap'> are each specified as a <length> or a <percentage>.


Is the width of the gutter separating the grid lines.
Is the width of the gutter separating the grid lines, relative to the dimension of the element.

Sintaxe formal

<'grid-row-gap'> <'grid-column-gap'>?


Conteúdeo de HTML

<div id="grid">

Conteúdo de CSS

#grid {
  display: grid;
  height: 200px;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  grid-gap: 20px 5px;

#grid > div {
  background-color: lime;


Especificação Estado Comentário
CSS Grid Layout
The definition of 'grid-gap' in that specification.
Candidate Recommendation Definição inicial

Compatibilidade de navegador


No compatibility data found. Please contribute data for "" (depth: 1) to the MDN compatibility data repository.


Consulte também