--- title: grid-gap slug: Web/CSS/gap translation_of: Web/CSS/gap translation_of_original: Web/CSS/grid-gap original_slug: Web/CSS/grid-gap ---
La propiedad CSS grid-gap es una propiedad abreviada shorthand para {{cssxref("grid-row-gap")}} y {{cssxref("grid-column-gap")}} que especifica los canales entre las filas y las columnas de la cuadrícula.
Si <'grid-column-gap'> se omite, adquiere el mismo valor que <'grid-row-gap'>.
{{cssinfo}}
/* Un valor <longitud> */ grid-gap: 20px; grid-gap: 1em; grid-gap: 3vmin; grid-gap: 0.5cm; /* Un valor <porcentaje> */ grid-gap: 16%; grid-gap: 100%; /* Dos valores <longitud> */ grid-gap: 20px 10px; grid-gap: 1em 0.5em; grid-gap: 3vmin 2vmax; grid-gap: 0.5cm 2mm; /* Uno o dos valores <porcentaje> */ grid-gap: 16% 100%; grid-gap: 21px 82%; /* Valores Globales */ grid-gap: inherit; grid-gap: initial; grid-gap: unset;
<longitud><percentage><div id="grid"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div>
#grid {
display: grid;
height: 200px;
grid-template: repeat(3, 1fr) / repeat(3, 1fr);
grid-gap: 20px 5px;
}
#grid > div {
background-color: lime;
}
{{EmbedLiveSample("Example", "100%", "200px")}}
| Especificación | Estado | Comentario |
|---|---|---|
| {{SpecName("CSS3 Grid", "#propdef-grid-gap", "grid-gap")}} | {{Spec2("CSS3 Grid")}} | definición inicial |
{{CompatibilityTable}}
| Característica | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Soporte básico | {{CompatChrome("57.0")}}[1] | {{CompatNo}}[3] | {{CompatGeckoDesktop("52.0")}}[2] | {{CompatNo}}[3] | {{CompatOpera(44)}}[4] | {{CompatNo}}[6] |
| <porcentaje> valor | {{CompatNo}} | {{CompatNo}}[3] | {{CompatGeckoDesktop("52.0")}}[2] | {{CompatNo}}[3] | {{CompatNo}}[4] | {{CompatNo}}[6] |
| Característica | Vista web de Android | Chrome para Android | Firefox Móvil (Gecko) | IE Móvil | Opera Móvil | Safari Móvil |
|---|---|---|---|---|---|---|
| Basic support | {{CompatChrome("57.0")}}[1] | {{CompatChrome("57.0")}}[1] | {{CompatUnknown}} | {{CompatGeckoMobile("52.0")}}[3] | {{CompatOperaMobile(44)}} | {{CompatUnknown}} |
| <porcentaje> value | {{CompatNo}} | {{CompatNo}} | {{CompatGeckoMobile("52.0")}}[5] | {{CompatNo}} | {{CompatNo}} | {{CompatNo}} |
[1] Implementado bajo la plataforma web experimental de características de etiquetas en chrome://flags since Chrome 29.0.
[2] Implemented behind the preference layout.css.grid.enabled since Gecko 40.0 {{geckoRelease("40.0")}}, defaulting to false. Since Gecko 52.0 {{geckoRelease("52.0")}} it is enabled by default.
[3] Internet Explorer implements an older version of the specification, which didn't define this property.
[4] Implemented behind the Enable experimental Web Platform features flag in chrome://flags since Opera 28.0.
[5] Implemented behind the preference layout.css.grid.enabled since Gecko 49.0 {{geckoRelease("49.0")}}, defaulting to false. Since Gecko 52.0 {{geckoRelease("52.0")}} it is enabled by default.
[6] Experimental implementation available in Safari Technological Preview.