CSS Spanning
<!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>grid spanning</title>
</head>
<style>
.container{
display: grid;
grid-template-columns: repeat(5,2fr);
grid-template-rows: repeat(4,2fr) ;
/* grid: grid 2rem; */
grid-gap: 1rem;
}
.box{
background-color: violet;
border: 2px solid black;
padding: 35px;
}
.box:first-child{
/* grid-column-start: 1;
grid-column-end: 3; */
grid-column: 1 / span 5;
grid-row: 1 / span 3;
}
.box:nth-child(4n){
grid-column: 1 / span 2;
grid-row: 1 / span 2;
}
</style>
<body>
<div class="container">
<div class="box">This is grid1</div>
<div class="box">This is grid2</div>
<div class="box">This is grid3</div>
<div class="box">This is grid4</div>
<div class="box">This is grid5</div>
<div class="box">This is grid6</div>
<div class="box">This is grid7</div>
<div class="box">This is grid8</div>
<div class="box">This is grid9</div>
<div class="box">This is grid10</div>
<div class="box">This is grid11</div>
<div class="box">This is grid12</div>
<div class="box">This is grid13</div>
<div class="box">This is grid14</div>
<div class="box">This is grid15</div>
<div class="box">This is grid16</div>
<div class="box">This is grid17</div>
<div class="box">This is grid18</div>
<div class="box">This is grid19</div>
<div class="box">This is grid20</div>
</div>
</body>
</html>
No comments:
Post a Comment