Monday, June 16, 2025
HomeCSShtml - How you can make css grid responsive in small display...

html – How you can make css grid responsive in small display screen


.dad or mum {
show: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, 1fr);
grid-gap: 10px;
}
.div{
background: teal;
padding: 12px;
}
.div:nth-child(1) { grid-area: 1 / 1 / 2 / 3; }
.div:nth-child(2) { grid-area: 1 / 3 / 2 / 4; }
.div:nth-child(3) { grid-area: 1 / 4 / 2 / 5; }
.div:nth-child(4) { grid-area: 2 / 1 / 3 / 2; }
.div:nth-child(5) { grid-area: 2 / 2 / 3 / 4; }
.div:nth-child(6) { grid-area: 2 / 4 / 3 / 5; }
<div class="dad or mum">
<div class="div">1</div>
<div class="div">2</div>
<div class="div">3</div>
<div class="div">4</div>
<div class="div">5</div>
<div class="div">6</div>
</div>
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments