CSS超簡單實現瀑布流

摘要:其實現在瀑布流的應用很是廣泛,沒有什麼指示體驗不錯,這裏我們就使用最簡單的來使用。

主要的就兩個,一個是控制父類,一個控制包裹住圖片的類

<!DOCTYPE html>
<html>
<style>
    .father{
        width: 100%;
        box-sizing: border-box;
        column-count: 2;
        column-gap:15rpx;
        padding: 0 20rpx;
    }
    .list{
        box-sizing: border-box;
        overflow: hidden;
        break-inside: avoid;
        border: 1px solid #efefef;
        border-radius: 6px;
        margin-bottom: 6px;
        background: #ffffff;
    }
</style>
<body>
    <div class="father">
        <div class="list"></div>
        <div class="list"></div>
        <div class="list"></div>
        <div class="list"></div>
        <div class="list"></div>
        <div class="list"></div>
    </div>

</body>
</html>

如果你想看下效果圖請參考詳細版: https://suxiexingchen.github.io/2019/12/27/32/

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章