css3虽然可以实现,不过要是真的运用到项目中还是老老实实写js吧
.container{
/*列的宽度*/
column-width:160px;
-webkit-column-width:160px;
-moz-column-width:160px;
/*列与列之间的间隙*/
column-gap:4px;
-webkit-column-gap:4px;
}
.container div{
width:160px;
margin:6px 0;
}
<div class="container">
<div><img src="images/P1.jpg" /></div>
<div><img src="images/P2.jpg" /></div>
<div><img src="images/P3.jpg" /></div>
</div>
时间: 2024-10-17 07:13:09