Grid-Column-Gap:
It defines the size of the gap between the columns in a grid layout.
Syntax:
grid-column-gap: length;
Grid-Row-Gap:
It defines the size of the gap between the rows in grid layout.
Syntax:
grid-row-gap: length;
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.grid-container {
display: grid;
grid-column-gap: 20px;
grid-row-gap: 20px;
grid-template-columns: auto auto auto;
background-color: pink;
padding: 10px;
}
.grid-item {
background-color: rgba(255, 255, 255, 0.8);
border: 2px solid ;
padding: 20px;
font-size: 30px;
text-align: center;
}
</style>
</head>
<body>
<h2>Grid-Column-Gap and Grid-Row-Gap Property</h2>
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
</div>
</body>
</html>
Output:
The Tech Platform
Commentaires