La propiedad CSS grid-column-gap
especifica el gutter entre grid columns.
/* <length> values */
grid-column-gap: 20px;
grid-column-gap: 1em;
grid-column-gap: 3vmin;
grid-column-gap: 0.5cm;
/* <percentage> value */
grid-column-gap: 10%;
/* Global values */
grid-column-gap: inherit;
grid-column-gap: initial;
grid-column-gap: unset;
El efecto es como si las grid lines afectadas adquieren una anchura específica: Los grid track entre dos líneas de la cuadrícula es el espacio entre los canales que las representa. Para el tamaño de la pista, cada canal se trata esencialmente como una pista adicional del tamaño especificado. Los valores negativos no son válidos.
Valor inicial | 0 |
---|---|
Applies to | grid containers |
Heredable | no |
Percentages | refer to corresponding dimension of the content area |
Valor calculado | the percentage as specified or the absolute length |
Animation type | a length |
Syntax
Valores
<length-percentage>
- Es el ancho del canal que separa las columnas de la grilla.
<percentage>
valores son relativos a la dimensión del elemento.
Sintaxis formal
<length-percentage>where
<length-percentage> = <length> | <percentage>
Ejemplo
HTML
<div id="grid">
<div></div>
<div></div>
<div></div>
</div>
CSS
#grid {
display: grid;
height: 100px;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: 100px;
grid-column-gap: 20px;
}
#grid > div {
background-color: lime;
}
Especificaciones
Especificación | Estado | Comentario |
---|---|---|
CSS Grid Layout La definición de 'grid-column-gap' en esta especificación. |
Candidate Recommendation | Definición incial |
Compatibilidad en navegadores
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "css.properties.grid-column-gap" (depth: 1) to the MDN compatibility data repository.
Ver también
- Propiedades CSS relacionadas:
grid-row-gap
,grid-gap
- Guía sobre CSS Grid Layout: Conceptos básicos sobre CSS Grid Layout - Gutters