gpt4 book ai didi

html - 仅使用 CSS 的砌体式布局

转载 作者:行者123 更新时间:2023-11-28 05:15:37 26 4
gpt4 key购买 nike

正如您在图像中看到的,每个框的高度都不同,有些框的宽度是原来的两倍。

Layout

是否可以仅使用 CSS 创建砖石风格的布局?

最佳答案

有了 css3 支持,你可以这样做:

http://jsfiddle.net/huAxS/2/

.container {
-moz-column-count: 2;
-moz-column-gap: 10px;
-webkit-column-count: 2;
-webkit-column-gap: 10px;
column-count: 2;
column-gap: 10px;
width: 360px;
}

.container div {
display: inline-block;
width: 100%;
background-color: red;
}​

由于不支持 css3,你不得不求助于 js。

关于html - 仅使用 CSS 的砌体式布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39333900/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com