How to use columns in a grid to wrap flex horizontally?
P粉481035232
2023-08-16 21:11:09
<p>https://codepen.io/itaied246/pen/eYbOWjm</p>
<p>I successfully created a flexbox with vertical scrolling that fills the space horizontally and scrolls down. </p>
<p>I want to do the same thing horizontally, i.e. fill the space vertically and scroll to the right. </p>
<p>My <code>flex</code> div is inside a corresponding <code>grid</code> with its <code>max-content</code>. </p><p>
What did I miss? </p>
You need to set a height on your flexbox. In this case, simply adding
height: 400px
to the .flex-columns class will solve the problem.The reason is that your flexbox assumes it can be as tall as possible, and since the flex direction is set to columns, it puts everything into one column. It's easier to visualize when the flexbox is a row!