简体   繁体   English

格式化列表项以将其垂直排列,然后在向左浮动时水平排列

[英]Formatting list items to alphabetize vertically and then horizontally when floated left

Assuming I have the following html: 假设我有以下html:

<ul id="a">
    <li>a</li>
    <li>b</li>
    <li>c</li>
    <li>d</li>
</ul>

And the following CSS: 以及以下CSS:

ul#a {width:20px;}
ul#a li {float:left; width:10px;}

The current output is: 当前输出为:

a   b
c   d

The output I'm going for is: 我要输出的是:

a   c
b   d

Is there any way to do this without breaking up the li's into two ul's? 有什么办法可以做到,不把li分解成两个ul?

Thanks, -Tom 谢谢-汤姆

This article from A List Apart may help you. A List Apart的这篇文章可能会对您有所帮助。 It is from 2005 though, so it may be somewhat outdated. 虽然是从2005年开始的,所以可能有些过时了。 Still, it is somewhere to start. 不过,这是一个起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM