Gecko 1.9 的 CSS3 列平衡
我在使用 CSS 3 列样式时遇到很多困难。我使用的是 Firefox 3.6,它应该支持 -moz-column 布局。
我有一个项目列表,我试图将它们呈现为两列,从上到下。为了帮助我的内部排序算法,第一个列表项是子列表。
我的 css 使用此
.container{
-moz-column-width:635; //slightly wider than the list item we're displaying
-moz-column-rule:1px solid;
}
.sub_list{
width:50%;
display:list-item;
}
.item{
overflow:hidden;
padding:0;
margin:0;
display:list-item;
width:634px;
}
不幸的是,我的列表显示为单列列表或多列布局,其中每个
都标记为 float:left;
但不是足够了,因为它是这样排序的:1 2
3 4
5 6
这不是我需要的,而且它看起来绝对丑陋,因为列表项 1 本身就是一个列表。
我发现的所有示例似乎都垂直排序列表项,并且它们不使用任何附加标签: http://weblogs.mozillazine.org/roc/archives/2005/03 /gecko_18_for_we.html 和/或 https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions 。
有人能告诉我我做错了什么吗?也许我无法正确理解布局引擎。
I am having a lot of difficulty using the CSS 3 columns style. I'm using Firefox 3.6 which should support the -moz-column layout.
I have a list of items and I'm trying to render them in 2 columns, top to bottom. To assist my internal sorting algorithm, the very first list item is a sub list.
my css uses this
.container{
-moz-column-width:635; //slightly wider than the list item we're displaying
-moz-column-rule:1px solid;
}
.sub_list{
width:50%;
display:list-item;
}
.item{
overflow:hidden;
padding:0;
margin:0;
display:list-item;
width:634px;
}
Unfortunately my list is displaying as a single column list or a multi column layout where each <li>
is marked float:left;
but which isn't sufficient since it orders thusly:
1 2
3 4
5 6
This isn't what I need, and it looks absolutely hideous because list item 1 is itself a list.
The examples I have found all seem to order the list items vertically and they don't use any additional tags:
http://weblogs.mozillazine.org/roc/archives/2005/03/gecko_18_for_we.html and/or
https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions .
Can anybody tell me what I'm doing wrong? Maybe I'm failing to understand the layout engine properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有人要求我正式“回答”这个问题,所以我将我的答案从评论转移到答案。
经过近一整天的研究和修改,我终于在发布问题后大约五分钟找到了答案。
我删除了 .item 的所有显示/位置相关样式。我不知道它们中的任何一个是否实际上与列格式兼容。您必须尝试一下或询问更有知识的人。
我给了 .container 一个固定的高度。
It's been requested that I officially "answer" this question so I'm moving my answer from the comment to an answer.
After nearly a full day of research and tinkering I finally tinkered my way to the answer about five minutes after posting the question.
I removed all display/position related styles for .item. Whether or not any of them are actually compatible with Column format I don't know. You'll have to experiement with it or ask someone more knowledgable.
I gave .container a fixed height.