0

How to display <li> elements in columns, with 4 elements in each column?

<ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
  <li>5</li>
</ul>

Displayed like this:

1 5
2
3
4

UPD. Number of 'li' elements is unknown

  • You might find [multi-column layouts](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns/Using_multi-column_layouts) useful. – showdev Jan 15 '18 at 23:48
  • Number of
  • elements is unknown
  • – user2549947 Jan 15 '18 at 23:55
  • Also see: [How to display list items as columns?](https://stackoverflow.com/questions/12332528/how-to-display-list-items-as-columns) AND [Is there a way to break a list into columns?](https://stackoverflow.com/questions/6509106/is-there-a-way-to-break-a-list-into-columns) – showdev Jan 16 '18 at 00:01
  • Possible duplicate of [Is there a way to break a list into columns?](https://stackoverflow.com/questions/6509106/is-there-a-way-to-break-a-list-into-columns) – AndrewSwerlick Jan 16 '18 at 01:40