我在css中有三个DIVS,在一个DIV中。当父div中div的值扩展时,我还有另外两个DIVS,所以父母应该让他自己也扩展,这不是这样的。
它只是扩展了内部DIVS,而不是父代DIVS,这是我的代码:
<div style="background-color:#000; color:#FFFFFF;
width:444px; height: auto;">
<div align="left" style="margin-top:10px; width:90px;
height:auto; background-color:#FFF; float:left;
color:#FF3; margin:5px 5px;">
Lable:
</div>
<div style="margin-top:10px; width:330px;
height:auto; margin:5px 5px; background-color:#FFF; float:right; color:#FF3; border:solid 1px #000;">
In here goes the value of the In here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the vae value of the
</div>
</div>
答案 0 :(得分:1)
使用overflow到parent元素,因为你的孩子divs浮动:
<div style="overflow: hidden; background-color:#000; color:#FFFFFF; width:444px; height: auto;">
或代替
使用float:left;
for childs
display: inline-block;
答案 1 :(得分:1)
答案 2 :(得分:1)
答案 3 :(得分:1)
试试这个,
<div style="background-color:#000; color:#FFFFFF;width: auto; height: auto;position: absolute;">
<div align="left" style="margin-top:10px; width:90px;
height:auto; background-color:#FFF; float:left;
color:#FF3; margin:5px 5px;">
Lable:
</div>
<div style="margin-top:10px; width:330px;
height:auto; margin:5px 5px; background-color:#FFF; float:right; color:#FF3; border:solid 1px #000;">
In here goes the value of the In here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the value of theIn here goes the vae value of the
</div>
</div>