I have menu with a number of elements that I don't know:
<ul>
<li>Link with long text 1</li>
<li>Link 2</li>
<li>Link 3</li>
<li>Link 4</li>
<li>Link 5</li>
<li>Link 6</li>
<li>Link 7</li>
</ul>
I'm trying to split it in 2 columns with auto width and equal amount of elements in each:
The following CSS does the job but it requires me to manually specify amount of rows.
ul {
display: grid;
gap: 10px 40px;
grid-auto-flow: column;
grid-template-rows: repeat(4, 1fr);
}
Is there any way to 'tell' CSS "rows should be half of element count"? Or maybe there are better ways to solve this?