The grid-column-gap
is the space between the columns in a grid.
This property accepts any length value, such as, px
, %
, em
, and others.
The default is 0, meaning there is no gap between the columns.
A grid container with a grid-column-gap
of 30-pixels.
<style>
.grid-container {
background-color: steelblue;
padding: 10px;
display: grid;
grid-column-gap: 30px;
grid-row-gap: 10px;
grid-template-columns: auto auto auto auto;
}
.grid-container > div {
background-color: aliceblue;
text-align: center;
padding: 15px 5px;
font-size: 18px;
}
</style>
<div class="grid-container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
</div>
grid-column-gap: length;
Note: The grid-column-gap
property is synonymous with column-gap. They can be used interchangeably.
Value | Description |
---|---|
length |
Default is 0. Any valid CSS length value. |
This table shows when grid-column-gap
support started for each browser.
Chrome
|
57 | Mar 2017 |
Firefox
|
52 | Mar 2017 |
IE/Edge
|
16 | Sep 2017 |
Opera
|
44 | Mar 2017 |
Safari
|
10 | Sep 2016 |