我希望我能得到一些技巧来实现我一直试图重新创建的某个图像库布局,以下是布局:
链接到该站点
https://www.styleshout.com/templates/preview/Sublime10/index.html
正如您所看到的,每一行上的一个图像比另一行高一点,并且其他行完全适合彼此。
下面是我做的一次微不足道的代码笔尝试,但我完全被困在如何获得这种布局上:
body {
margin: 0;
border-sizing: border-box;
display: flex;
justify-content: center;
width: 100%;
}
figure {
margin: 0;
display: inline;
}
.gallery-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 600px;
figure {
height: 350px;
picture img {
width: 350px;
height: 350px;
}
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Flexible Image Gallery</title>
</head>
<body>
<div class="gallery-container">
<figure>
<picture>
<img src="https://source.unsplash.com/random/204x200" alt="" />
</picture>
</figure>
<figure>
<picture>
<img src="https://source.unsplash.com/random/209x200" alt="" />
</picture>
</figure>
<figure>
<picture>
<img src="https://source.unsplash.com/random/205x200" alt="" />
</picture>
</figure>
<figure>
<picture>
<img src="https://source.unsplash.com/random/202x200" alt="" />
</picture>
</figure>
<figure>
<picture>
<img src="https://source.unsplash.com/random/201x200" alt="" />
</picture>
</figure>
<figure>
<picture>
<img src="https://source.unsplash.com/random/206x200" alt="" />
</picture>
</figure>
</div>
</body>
</html>
谢谢你的帮助!