2012-08-13 122 views
3

我需要垂直顯示列表項目以及多列。但必須只使用單個ul。這怎麼可能。請建議我。在單個ul和多列中垂直顯示列表項目

輸出應該看起來像

a e i 
b f j 
c g 
d h 

感謝所有幫助

+2

可能重複[我想顯示列表項目爲2列或更多列(動態對齊)](http://stackoverflow.com/questions/8092830/i-want-to-show-list-items-as- 2-more-columns-dynamic-alignment) – sandeep 2012-08-13 09:12:10

+1

你好習慣http://www.quirksmode.org/css/multicolumn.html這個專欄http://trentwalton.com/2010/07/19/css3 - 多列布局列數/ – 2012-08-13 09:13:09

回答

3

據我所知做到這一點的唯一方法是使用column-count

ul { 
    column-count: 3; 
} 

請注意,它只能在現代瀏覽器並需要供應商前綴(-webkit-column-count等)。

如果你使用float,inline或inline-block,它們將以不同的順序渲染。