我有一个div
与另一个div
里面。第二个div
有width
,height
和background-color: green
。这个有绝对的位置,所以它的容器没有显示。溢出位置绝对
<div id="root">
<div id="r1">
<div id="r2">
</div>
</div>
Mas
</div>
CSS文件
#root{
width:300px;
background-color: red;
}
#r1{
position: relative;
width: 100px;
background: yellow;
}
#r2{
position: absolute;
display: inline-block;
width: 50px;
height: 50px;
left: 0;
background-color: green;
}
我想知道,如果有可能,它的容器是,敷用绝对位置的股利。
我想看到类似的东西,但没有使用相对位置,也没有为其容器添加高度。
谢谢!
请在您的问题中包含相关代码。 – hjpotter92
当你将div声明为绝对时,它不包含在父标签中。所以包装不能按需要完成。 – Narendra
'没有使用相对位置并且没有增加高度?任何原因 ? – zey