How to create a 3X3 grid using CSS



In this tutorial, we will see how to create a simple 3X3 grid by using CSS grid.

This is a basic 3X3 grid layout. I should also mention here, that this is only an example of 3X3 grid layout. It is not responsive.


3X3 grid Source Code:

<!doctype html>
<html lang="en">
		<!-- Required meta tags -->
		<title>3X3 Grid Demo - CodeHasBug</title>
		<meta name="description" content="This is a demo of how to create 3x3 grid in CSS" />
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<!-- Bootstrap CSS -->
		<link rel="stylesheet" href="" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
		<link rel="icon" href="" sizes="32x32" />
		<link rel="icon" href="" sizes="192x192" />
		<link rel="apple-touch-icon" href="" />
		<meta name="msapplication-TileImage" content="" />
			.header	.custom-logo{
				width: 140px;
				height: auto;
				position: relative;
				height: 80px;
			*	Main style start here
				display: grid;
				grid-gap: 20px;
				grid-template-columns: repeat(3, 1fr);
				margin-bottom: 40px;
				display: flex;
				align-items: center;
				justify-content: center;
				box-shadow: 0 0px 2px rgb(0 0 0 / 7%), 0 5px 6px rgb(0 0 0 / 16%);
				height: 200px;
				background-color: #ffe186;
		<div class="container">	
			<div class="row">
				<div class="col-12 mt-5 text-center">
					<h1>3X3 Grid Demo</h1>
			<div class="row mt-3">
				<div class="col-12">
					<div class="grid-box">
						<div class="cell"> Cell 1 </div>
						<div class="cell"> Cell 2 </div>
						<div class="cell"> Cell 3 </div>
						<div class="cell"> Cell 4 </div>
						<div class="cell"> Cell 5 </div>
						<div class="cell"> Cell 6 </div>
						<div class="cell"> Cell 7 </div>
						<div class="cell"> Cell 8 </div>
						<div class="cell"> Cell 9 </div>
			<div class="spacer"></div>
		<script src=""></script>
		<script src=""></script>

About Ashis Biswas

A web developer who has a love for creativity and enjoys experimenting with the various techniques in both web designing and web development. If you would like to be kept up to date with his post, you can follow him.

Leave a Comment