Grid Template
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="hello.css">
<title>GRID</title>
</head>
<body>
<h1>Grid Playground</h1>
<div class="container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
</body>
</html>
CSS
.container{
width: 600px;
height: 300px;
background-color: rgb(244, 226, 204);
display: grid;
/* 1st method */
/* grid-template-rows : auto ;
grid-template-columns: auto auto; */
/* 2nd Method
grid-template-rows : 50px 50px 50px 50px ;
grid-template-columns: 50px ; */
/* 3rd method :- */
grid-template-rows : repeat(3, 1fr) ;
grid-template-columns: repeat(3 ,1fr) ;
}
.item{
/* height: 50px;
width: 100px; */
border: 2px solid black;
background-color: chartreuse;
text-align: center;
padding: 9px;
}
Comments
Post a Comment