3 columns grid (top to bottom) using grid CSS

前端 未结 4 1911
醉梦人生
醉梦人生 2021-01-17 13:59

Ok, here\'s the situation, let\'s say I have a list with unknown number of items, it could be 10 or a 100, and I want to lay them out in 3 columns going top to bottom not le

4条回答
  •  不知归路
    2021-01-17 14:44

    I've used a little JavaScript here.Where 'lst' is id of the UL. I've used the CSS variables to pass the value of elements in the UL and ultimately calculating the required columns as per the requirement. Only downside being we will need to check if the total element number os odd or even.

    
    
    
    

提交回复
热议问题