瀑布流布局

瀑布流布局

code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<div class="root">
<div class="item">
<img class="itemImg" src="https://images.unsplash.com/photo-1621423028651-b32c4e9aaa57?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw3fHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt=""/>
<div class="userInfo">
<span class="username">描述1</span>
</div>
</div>
<div class="item">
<img class="itemImg" src="https://images.unsplash.com/photo-1621419079793-73020baef9eb?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw5fHx8ZW58MHx8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt=""/>
<div class="userInfo">
<span class="username">描述2</span>
</div>
</div>
<div class="item">
<img class="itemImg" src="https://images.unsplash.com/photo-1621387178623-8ed20c36278b?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyMHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt=""/>
<div class="userInfo">
<span class="username">描述3</span>
</div>
</div>
<div class="item">
<img class="itemImg" src="https://images.unsplash.com/photo-1611896154563-70f0a227013a?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxMnx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt=""/>
<div class="userInfo">
<span class="username">描述4</span>
</div>
</div>
<div class="item">
<img class="itemImg" src="https://images.unsplash.com/photo-1621416945515-7682f934e824?ixid=MnwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwxM3x8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60" alt=""/>
<div class="userInfo">
<span class="username">描述5</span>
</div>
</div>
</div>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.root {
margin: 10px;
/* width: 100%; */
column-count: 2;
/* column-width: 50%; */
column-gap: 10px;
}
/* 每一列图片包含层 */
.item {
margin-bottom: 10px;
/* 防止多列布局,分页媒体和多区域上下文中的意外中断 */
break-inside: avoid;
background: #fff;
}
/* 图片 */
.itemImg {
width: 100%;
vertical-align: middle;
}
# CSS
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×