我找到了一个没有JS的解决方案,它在除了IE以外的任何浏览器中都可以工作(叹气!但是可以优雅地退化)
也许这个链接中有一个解决方案:http://codeasily.com/jquery/multi-column-list-with-jquery
使用column-count
CSS。
有没有可能拥有一个像html5.js一样启用column-count的脚本(它不起作用)?
Safari中存在一些尴尬的边框问题
http://jsfiddle.net/HerrSerker/f5Zjt/4/
HTML
<div class="wrap">
<div class="wrap_1">
<img src="http://lorempixel.com/400/200/sports/2" width="400" height="200" />
<h2>Some text, can be multiple lines</h2>
</div>
<div class="wrap_2">
<div class="inner">
<div class="wrap_3">
<img src="http://lorempixel.com/40/40/sports/1" width="40" height="40" />
<div class="detail">Some text, can be multiple lines, that is possible</div>
</div>
<div class="wrap_3">
<img src="http://lorempixel.com/40/40/sports/1" width="40" height="40" />
<div class="detail">Some text, can be multiple lines, that is possible</div>
</div>
<div class="wrap_3">
<img src="http://lorempixel.com/40/40/sports/3" width="40" height="40" />
<div class="detail">Some text, can be multiple lines, that is possible</div>
</div>
<div class="wrap_3">
<img src="http://lorempixel.com/40/40/sports/1" width="40" height="40" />
<div class="detail">Some text, can be multiple lines</div>
</div>
<div class="wrap_3">
<img src="http://lorempixel.com/40/40/sports/1" width="40" height="40" />
<div class="detail">Some text, can be multiple lines</div>
</div>
</div>
</div>
</div>
CSS
body {
padding: 10px;
}
.wrap {
width: 600px;
border: 1px solid silver;
padding: 5px;
overflow: hidden;
position: relative;
}
.wrap_1 {
float: left;
width: 400px;
padding: 5px;
border: 1px solid gold;
overflow: hidden;
text-overflow: ellipis;
}
.wrap_2 {
top: 5px;
bottom: 5px;
right: 5px;
position: absolute;
width: 170px;
padding: 5px;
border: 1px solid gold;
overflow: hidden;
}
.wrap_2 > .inner {
position: absolute;
top:5px;
bottom: 5px;
left: 5px;
width: 350px;
-moz-column-width: 170px;
-webkit-column-width: 170px;
-o-column-width: 170px;
-ms-column-width: 170px;
column-width: 170px;
-moz-column-gap: 5px;
-webkit-column-gap: 5px;
-o-column-gap: 5px;
-ms-column-gap: 5px;
column-gap: 5px;
}
.wrap_3 {
width: 158px;
padding: 5px;
border: 1px solid brown;
overflow: hidden;
}
.wrap_3+.wrap_3 {
margin-top: 5px;
}
.wrap_1 h2 {
font-size: 24px;
font-family: sans-serif;
}
.wrap_3 img {
vertical-align: top;
display: inline-block;
*zoom: 1;
*display: inline;
width: 40px;
margin-right: 5px;
}
.wrap_3 .detail {
display: inline-block;
*zoom: 1;
*display: inline;
overflow: hidden;
font-size: 14px;
font-family: sans-serif;
width: 108px;
vertical-align: top;
}