本帖最后由 大郎 于 2024-4-2 19:39 编辑
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui:ios">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="">
<script src=""></script>
<style>
img{
vertical-align: top;
}
.container{
width: 1200px;
margin: 20px auto;
/* 子元素拆分成4列 */
column-count: 4;
/* 子元素间距为20px */
column-gap: 20px;
}
.card {
margin-bottom: 20px;
}
.card img{
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
<div class="card">
<img src="1.jpg" alt="">
</div>
<div class="card">
<img src="2.jpg" alt="">
</div>
</div>
</body>
</html>
|