瀑布流布局
瀑布流布局是一种新型的布局方式,可以将大小不一的图片完整的显示在页面上,并且在杂乱的布局中保持着一定的美感,今天学习了一下如何使用瀑布流布局,总结了有以下三种方式。(瀑布流还可以使用grid布局实现,还没有学习过这种方式)
java
<div class="container" id="con">
<div class="item">
<img src="../img/1.jpeg" alt="">
</div>
<div class="item">
<img src="../img/2.jpeg" alt="">
</div>
<div class="item">
<img src="../img/3.jpeg" alt="">
</div>
<div class="item">
<img src="../img/4.jpeg" alt="">
</div>
<div class="item">
<img src="../img/5.jpeg" alt="">
</div>
<div class="item">
<img src="../img/6.jpeg" alt="">
</div>
<div class="item">
<img src="../img/7.jpeg" alt="">
</div>
<div class="item">
<img src="../img/8.jpeg" alt="">
</div>
<div class="item">
<img src="../img/9.jpeg" alt="">
</div>
<div class="item">
<img src="../img/10.jpeg" alt="">
</div>
<div class="item">
<img src="../img/11.jpeg" alt="">
</div>
<div class="item">
<img src="../img/12.jpeg" alt="">
</div>
<div class="item">
<img src="../img/13.jpeg" alt="">
</div>
<div class="item">
<img src="../img/14.jpeg" alt="">
</div>
<div class="item">
<img src="../img/15.jpeg" alt="">
</div>
</div>
java
.container{
column-count: 4;//想要排成的列数
column-gap: 0;
}
.item img{
width: 100%;
}