Reputation: 157
Anyone have idea, why when I using css columns it behave very strange? I mean i've got
ul{
columns: 4;
column-gap: 100px;
column-rule: 1px solid #eaeef6;
}
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
</ul>
My expectation is to display it like that:
A|B|C|D|
E| | | |
But i've got that:
A|C|D| |
B| |E| |
Why? thanks
Upvotes: 2
Views: 240
Reputation: 95
I can suggest you use display: grid if that might help?
ul{
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
If you want it to wrap, you use media queries or flex ( flex-direction: row; flex-wrap: wrap ) but then you would kinda lose the column aspect of your "table" if that is supposed to be one.
Hopefully this helps
Upvotes: 1
Reputation: 5335
Maybe you're looking to set your grid up like this?
ul{
display: grid;
grid-template-columns: auto auto auto auto;
column-gap: 100px;
column-rule: 1px solid #eaeef6;
}
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
</ul>
Upvotes: 0