I have a total of 20 elements to display in a grid view. However, I specifically want a 3x3 grid view, where only 9 elements will be visible in the view window. The remaining elements should be placed on the right side of the window in a scrollable manner.
Irrespective of the screen size, I aim to showcase only the initial 9 elements in the grid.
.items {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
grid-gap: 5px;
}
.item {
background-color: dodgerblue;
color: white;
padding: 1rem;
height: 4rem;
}
<div class="items">
<div class="item">ONE</div>
<div class="item">TWO</div>
<div class="item">THREE</div>
<div class="item">FOUR</div>
<div class="item">FIVE</div>
<div class="item">SIX</div>
<div class="item">SEVEN</div>
<div class="item">EIGHT</div>
<div class="item">NINE</div>
<div class="item">TEN</div>
<div class="item">ELEVEN</div>
<div class="item">TWELVE</div>
</div>