作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试堆叠盒子。如果我垂直开始,我知道该怎么做,比如从顶部开始然后向下。我的问题是,我该怎么做横向?
Here is how i did it vertically
Here is how i tried doing it horizontally
.box1 {
float:left;
width:150px;
margin-right:20px;
border:1px solid;
height:100px;
}
.box2 {
float: left;
width:150px;
height:20px;
margin-right:20px;
border:1px solid;
}
.box3 {
float: left;
width:150px;
margin-right:20px;
border:1px solid;
height:200px;
}
.box4 {
clear:both;
float: left;
width:150px;
margin-right:20px;
border:1px solid;
height:200px;
}
最佳答案
我不确定我是否理解您的意思。这是一次粗略的尝试。您可以使用定位和 z-index 来实现结果。
position: absolute;
top:10px;
z-index:1;
https://jsfiddle.net/78qptee4/
顺便说一句,您可能会发现这很有用: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
关于html - 堆放 div 的盒子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28974418/
我正在尝试堆叠盒子。如果我垂直开始,我知道该怎么做,比如从顶部开始然后向下。我的问题是,我该怎么做横向? Here is how i did it vertically Here is how i t
我是一名优秀的程序员,十分优秀!