I would like to create one UL list that will contain a variable number of LI elements. I would like the heigh of the container to be max 500px. Which means if i have more li elements that go over that 500px height i want it to turn into 2 columns. If there is more then can fit for 2 columns i would like it to turn into 3 columns. I have enough space to fix max 5 columns and the data will never go over that amount.
Any idea how i can do this? Any jquery, css tricks? or do i need to handle each scenario server side to do this.
Example 1
list entry list entry
list entry list entry
list entry list entry
list entry list entry
list entry
Example 2
list entry list entry list entry
list entry list entry list entry
list entry list entry list entry
list entry list entry
list entry list entry
Example 3
list entry list entry list entry list entry
list entry list entry list entry list entry
list entry list entry list entry list entry
list entry list entry list entry
list entry list entry list entry
If it cant be achieved without one UL then i am open to that.
Thanks!