css3 实现瀑布流
Posted 沿着路走到底
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css3 实现瀑布流相关的知识,希望对你有一定的参考价值。
1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*
margin: 0;
padding: 0;
box-sizing:border-box;
.wrap
margin-top: 50px;
width: 100%;
padding: 0 20px;
/* 瀑布流容器内元素的间隔 */
column-gap:10px;
/* 瀑布容器内排列的列数 */
column-count: 2;
.item
padding: 10px;
border: 1px solid #000;
margin-bottom: 10px;
height: 50px;
/* avoid避免在主体框中插入任何中断(页面,列或区域) */
break-inside: avoid;
</style>
</head>
<body>
<div class="wrap">
<div class="item">1</div>
<div class="item">2</div>
<div class="item" style="height:90px;">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
<div class="item">10</div>
<div class="item">11</div>
<div class="item">12</div>
<div class="item">13</div>
<div class="item">14</div>
</div>
</body>
</html>
1
以上是关于css3 实现瀑布流的主要内容,如果未能解决你的问题,请参考以下文章