CSS grid-gap Property

❮ Previous Reference Next ❯

Example

.grid-container {
  display: grid;
  grid-gap: 50px;
}





1
2
3
4
5
6
7
8

Meaning

The grid-gap shorthand property specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area.

Default value:0 0
Inherited:No
Animatable:Yes
Version:CSS Grid Layout Module Level 1
JavaScript syntax:
object.style.gridGap="grid-row-gap grid-column-gap|initial|inherite|revert|revert-layer|unset";



Standard Syntax

grid-gap: grid-row-gap grid-column-gap|initial|inherite|revert|revert-layer|unset;



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Property Values

The following table describes the values of this property.

Value Description
grid-row-gap 0 is the default value. Specifies the size of the gap between the rows in a grid layout.
grid-column-gap 0 is the default value. Specifies the size of the gap between the columns in a grid layout.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  grid-gap: 0 0;
}
❮ Previous Reference Next ❯