I have several cards within a column made with Bootstrap 5:
https://jsfiddle.net/fzxc1v69/
Currently each of the cards are aligned one below the other, but I don’t want that.
As you can see, my .section
was made to only occupy the entire browser window (height: 100vh
).
The problem is that the vertical scroll is activated, while I would actually like to activate the horizontal scroll so that the cards line up as follows:
How can I do this?
2
Answers
making the direct parent of the cards
display: flex
should do what you want.basically, the default for
display: flex
isflex-direction: row
, which align the items in a horizontal row.Other than that, adding to the cards
flex-grow: 0; flex-shrink: 0
makes them not shrink or expand based on the available space, so they will scroll instead of fitting inside the viewport.If this helped, please upvote and mark the answer 🙏
One fix for this would be to separate the cards between multiple columns, something like:
(Note that I have changed the width for the row to be 1200px (4x the column width) and the width for the section div to be auto)