CSS MinMax Concept
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>minmax autofit</title>
</head>
<style>
.container{
display: grid;
/* grid-template-columns: repeat(); */
grid-template-columns: repeat(auto-fit,minmax(350px,1fr));
grid-template-rows: repeat(auto-fit,minmax(350px,1fr));
/* grid: grid 1.5rem; */
grid-gap: 1.5rem;
}
.box{
border: 2px solid black;
background-color: green;
padding: 35px;
}
.box:first-child{
/* grid-template: 1; */
grid-column: 1 / span 2;
/* grid-row: 1 / span 2; */
grid-row: 1 / span 2;
}
</style>
<body>
<div class="container">
<div class="box">This is a grid1</div>
<div class="box">This is a grid2</div>
<div class="box">This is a grid3</div>
<div class="box">This is a grid4</div>
<div class="box">This is a grid5</div>
<div class="box">This is a grid6</div>
<div class="box">This is a grid7</div>
<div class="box">This is a grid8</div>
<div class="box">This is a grid9</div>
<div class="box">This is a grid10</div>
<div class="box">This is a grid11</div>
<div class="box">This is a grid12</div>
<div class="box">This is a grid13</div>
<div class="box">This is a grid14</div>
<div class="box">This is a grid15</div>
</div>
</body>
</html>
No comments:
Post a Comment