我有一个高度设置为页面 100% 的 div(在本例中,我们将其称为 #container)。在#container 中,我有一个包含 101 项的有序列表。我正在寻找一种干净、有效的方法,让有序列表根据#container 的高度分成几列。可以想象,这种大小的有序列表会在垂直方向上扩展得比#containers 高度大得多。我希望 OL 自动分成列,以便 #container 不必扩展。
问问题
233 次
1 回答
0
You can try something like this
#container {
width:100%; //or whatever width you have
height:100%;
}
ul {
padding:0;
margin:0;
list-style:none; // gets rid of typical behavior of ul
}
li {
position:relative;
width: 200px; // some specific width, play with this value.
height: 200px;
float:left;
}
I would recommend adjusting size of list items accordingly to available width of screen through @media directives and rather using percentage than fixed sizes.
BTW : i believe that you should also be using #container {min-height:100%;}
because i dare say you dont always have space available in one screen.
于 2014-05-03T22:28:50.147 回答