-1
A
回答
0
这里是所有你需要
div {
height: 100px;
width: 100px;
background: #ccc;
position: absolute;
top: 0;
left: 0;
}
.div1{
background: #f00;
}
.div2{
top: 30px;
}
.div_child{
background: #3a2525;
left: auto;
right: 0;
width: 50px;
z-index: 1;
}
<div class="div1">
1
<div class="div_child">
child
</div>
</div>
<div class="div2">
2
</div>
0
几乎任何可能与CSS3。然而div 1中的元素需要分开才能工作。如果它在div 1内,它会将div 1拖动到其中。你会得到更大的灵活性,如果侧DIV是在它自己的
但是对于你的具体的例子,你会需要这样的东西:
HTML:
<div class="top"></div>
<div class="bottom"></div>
<div class="side"></div>
CSS:
.top {
width: 90%;
margin-left: 10%;
height: 200px;
height: 250px;
background: red;
}
.bottom {
width: 90%;
height: 200px;
height: 250px;
margin-left: 5%;
background: grey;
margin-top: -150px;
}
.side {
width: 20%;
height: 200px;
height: 250px;
margin-left: 78%;
background: yellow;
margin-top: -300px;
}
Working CodePen也在这里:https://codepen.io/WebDevelopWolf/pen/mBLqxm
0
不知道为什么会这样的作品,但它可能对你会有所帮助:
#div1, #div2{
width: 100%;
height: 400px;
}
#div1{
background-color: red;
position: relative;
}
#div2{
background-color: green;
}
#div2{
margin-left: 50px;
margin-top: -300px;
position: relative;
}
#div1 > div{
background-color: yellow;
position: absolute;
width: 200px;
height: 200px;
right: 0;
top: 50px;
z-index: 2;
}
.as-console-wrapper{ display: none !important;}
<div id="div1">
DIV 1
<div>INSIDE DIV 1</div>
</div>
<div id="div2">
DIV 2
</div>
相关问题
- 1. 一个HTML IMG堆叠2周的div
- 2. 堆叠扩展DIV
- 3. 堆叠div元素
- 4. CSS - 堆叠的DIV布局
- 5. 滚动时堆叠div
- 6. Div标签互相堆叠
- 7. Div与div(HTML/CSS)重叠?
- 8. Html css重叠div
- 9. HTML和CSS堆叠框
- 10. 垂直堆叠html元素
- 11. 防止Div的向下堆叠
- 12. 如何在彼此之上堆叠Div
- 13. Div互相重叠 - HTML
- 14. 闪存重叠的HTML div
- 15. HTML中的重叠div
- 16. 从右下角开始堆叠div div123s
- 17. div堆叠/布局与CSS或javascript
- 18. jQuery的AJAX问题,堆叠的div
- 19. 堆叠DIV和水平对齐
- 20. 并排呈现并堆叠的Div
- 21. 堆叠和转移的div响应
- 22. Div在响应式设计中堆叠
- 23. 如何使用Flexbox Grid堆叠div?
- 24. 堆叠格在另一个DIV
- 25. Div和Jquery Slider的堆叠问题
- 26. 重叠父div的HTML/CSS div
- 27. 堆叠/重叠UITableViewCells
- 28. 堆叠HTML元素的顺序
- 29. HTML表格没有正确堆叠
- 30. Html CSS圆角帮助堆叠元素
我认为这将是越容易黄色的将是'div的孩子2' – Swellar
你有什么实现?这看起来很简单,如果你不给“DIV 2”提供任何Z-index,那么你可以使用绝对/固定定位将'ELEMENT INSIDE DIV 1'放置在'DIV 2'之上。 –
我觉得这个问题已经被StackOverflow问了太多次了:你尝试过搜索吗? – Terry