css常用布局-多列布局(瀑布流)详解及案例
设置或检索对象的列与列之间的边框。复合属性。
column-rule-color规定列之间规则的颜色。
column-rule-style规定列之间规则的样式。
column-rule-width规定列之间规则的宽度。
设置或检索对象所有列的高度是否统一
auto:列高度自适应内容
balance:所有列的高度以其中最高的一列统一
5、column-span
设置或检索对象元素是否横跨所有列。
none:不跨列
all:横跨所有列
6、column-width
设置或检索对象每列的宽度
效果图如下所示:
具体实现代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,html{
width: 100%;
height: 100%;
background: url(./images/1.gif);
background-size: 50% 50%;
}
.content{
width: 100%;
column-count: 5;
column-gap: 0;
}
.content div{
border: 5px #eee solid;
padding: 10px;
margin: 0 5px 10px;
}
.content div img{
width: 100%;
}
.content div p{
text-align: center;
font-size: 20px;
color: #fff;
font-weight: bold;
}
</style>
</head>
<body>
<div class="content">
<div>
<img src="./images/2.jpg" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/2.jpg" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/3.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/4.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/5.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/6.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/7.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/8.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/9.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/10.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/11.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/12.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/13.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/14.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/15.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/16.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/17.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/1.gif" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/2.jpg" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/3.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/4.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/5.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/6.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/7.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/8.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/9.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/10.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/11.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/12.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/13.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/14.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/15.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/16.png" alt="">
<p>今后余生,风雪是你</p>
</div>
<div>
<img src="./images/17.png" alt="">
<p>今后余生,风雪是你</p>
</div>
</div>
</body>
</html>
如果感觉对自己有帮助,麻烦点一下关注,会一直盒大家分享知识的,谢谢!!!
所有程序员都是好编剧,所有计算机都是烂演员