CSS Grid Layout Properties with Examples


The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning.


<!DOCTYPE html>
.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
  background-color: pink;
  padding: 15px;

.grid-item {
  background-color: white;
  border: 1px solid ;
  padding: 20px;
  font-size: 30px;
  text-align: center;

<h1>CSS Grid Layout</h1>

<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>