【发布时间】:2013-07-20 00:31:50
【问题描述】:
我为图片库创建了一个 CSS3 多列布局,在 Firefox 上看起来不错。
HTML:
<section id="featured">
<article>
<img src="http://sheepy.me/incoming/images/posts/blog/thumb_tim-burton-pokemans.png" />
</article>
<article>
<img src="http://sheepy.me/incoming/images/posts/blog/thumb_hem-tourniquet.png" />
</article>
<article>
<img src="http://sheepy.me/incoming/images/posts/blog/thumb_hem-tourniquet.png" />
</article>
<article>
<img src="http://sheepy.me/incoming/images/posts/blog/thumb_tim-burton-pokemans.png" />
</article>
<article>
<img src="http://sheepy.me/incoming/images/posts/blog/thumb_tim-burton-pokemans.png" />
</article>
css:
#featured {
width: 730px;
padding: 20px;
-webkit-column-count: 2;
-webkit-column-gap: 10px;
-webkit-column-fill: balance;
-moz-column-count: 2;
-moz-column-gap: 10px;
-moz-column-fill: balance;
column-count: 2;
column-gap: 10px;
column-fill: balance;
background: #7d90a5;
}
article {
width: 300px;
display: block;
background: #344252;
-webkit-column-break-inside: avoid;
-moz-column-break-inside: avoid;
column-break-inside: avoid;
padding: 10px;
width: 335px;
margin-bottom: 20px;
}
article img{
width: 335px;
display: block;
}
问题是,当我使用 Chrome 浏览器打开它时,它会在 <section> 的底部添加额外的空间,我不知道要修复它。
我在网上搜索并找到了这个thread,但我不确定它是否是同一个问题。
检查此fiddle 链接并尝试同时使用 Chrome 和 Firefox 打开。
【问题讨论】:
-
我不知道解决方案,但是当您从
article样式中删除-webkit-column-break-inside: avoid;时,大空间消失了。然而,这会在右栏的顶部留下看似空白但不存在的文章。 -
是的,这会破坏右上角的图片。我还在寻找纯css解决方案...
标签: html css webkit multiple-columns