Multi-column CSS lists

前端 未结 5 1517
抹茶落季
抹茶落季 2020-12-19 06:26

Is there a way to do re-flowable, multi-column lists, where the list can have list items of varying heights, using only valid CSS? By re-fl

5条回答
  •  情歌与酒
    2020-12-19 07:10

    I realize this is an old post, but I just got this working on my project, and Ilya's solution did not work for me (though maybe I missed something). Anyway, the problem is that with CSS3 columns (now a Candidate Recommendation) the overflow wants to go off to the right by creating additional columns, and if you have overflow:auto you end up with a horizontal scrollbar, instead of a vertical one (which the OP wanted, and I also wanted). I fixed this by wrapping the div that held the columns (with -moz-column-count set) inside another div, and setting the height on that one with overflow-y:auto. The meant that the outer div could scroll vertically, while the inner div with the columns had as much height as it needed and did not need to overflow horizontally.

    I hope the helps.

提交回复
热议问题