我有一个目录页面,列出目录中的故事,我想在3列中显示它们。我希望输出在三列之间保持平衡,这样每列的高度大致相同。每个项目的高度都不相同。
但是我发现Chrome没有正确地平衡列,所以前两列非常长,最后(第3)列非常短,通常只有1或2个项目。我添加了属性
column-fill: balance;
可以肯定的是,尽管它应该是默认值,但它没有任何区别。任何帮助表示赞赏。
CSS
#catalogue-section {
/* Prevent vertical gaps */
line-height: 0;
-webkit-column-count: 3;
-webkit-column-gap: 0px;
-webkit-column-fill: balance;
-moz-column-count: 3;
-moz-column-gap: 0px;
-moz-column-fill: balance;
column-count: 3;
column-gap: 0px;
column-fill:balance;
}
#catalogue-section div {
/* Just in case there are inline attributes */
width: 100% !important;
height: auto !important;
}
HTML
请参阅http://www.shortkidstories.com/story
如果您在IE或Firefox中转到此页面,则会平衡列,但不会在Chrome中。
答案 0 :(得分:0)
(仅限发布让其他人知道已解决)
答案 1 :(得分:0)
以下是部分解决方案:
height: auto !important;
#catalogue-section div
div.catalogue
添加更多高度,例如min-height: 322px;