add display grid to parent element and for the child, use this:
display: grid;
grid-gap: 16px;
padding: 16px;
grid-template-columns: repeat(auto-fill,minmax(160px,1fr));
grid-auto-flow: column;
grid-auto-columns: minmax(160px,1fr);
overflow-x: auto;
grid-auto-flow: column; will force the grid to add your elements as column instead of following the free space.
grid-auto-columns: minmax(160px,1fr); the items added outside the viewport do not match auto-fit, so they won't get the size defined in your template. So you have to define it again with grid-auto-columns.
overflow-x: auto; auto will add the scrollbar
Code Example |
---|
Css :: compass font awesome |
Css :: change color accordion arrow bootstrap 5 |
Css :: css darkmode |
Css :: the difference between nth-child() and nth-of-type() |
Css :: how to change another element on hover |
Css :: How to horizontally center an element |
Css :: place image on top right inside flex css |
Css :: sass loops |
Css :: change element in iframe |
Css :: css glass effect |
Css :: css disabled cursor not allowed |
Css :: css image transition fade |
Css :: @each scss |
Css :: css border shorthand |
Css :: smooth scroll |
Css :: how to add outline to text in css |
Css :: text flow top to bottom |
Css :: flexbox align last item right |
Css :: double border color css |
Css :: align-self in css |
Css :: disabled checkbox css |
Css :: add quotes in quote css |
Css :: flex justify-content |
Css :: arrow left css |
Css :: sass vs scss |
Css :: make image background of div |
Css :: css text rotate |
Css :: outline bottom css |
Css :: css not full width |
Css :: width fit content |