D
D
djok21422021-06-09 21:42:07
css
djok2142, 2021-06-09 21:42:07

How to make a multi-column list using flexbox?

Good afternoon.
I'm trying to make a list with multiple columns. So that the items go from top to bottom, that is,
1 4 7
2 5 8
3 6 9
ul element added flex-direction: column; and flex-wrap: wrap;
the child li elements lined up as they should, but the ul itself is only the width of the first column, and the second and third columns go beyond its borders. I think this happens because of position: absolute; but without it, in this case, there is no way, the positioning of the ul or its parent must be absolute.
Setting a fixed width for it is also not an option, since the number of items in the list can be different.
How then, in this case, to make the ul stretch to the full width of the content?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2021-06-10
@SlavaMaxwell

column-countand flexbox is not even needed
https://webref.ru/css/column-count

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question