so i have this:
<div id="parent">
<div id="child"></div>
</div>
styled like this:
#parent {
width: 100%;
padding: 10px;
}
#child {
position: absolute;
width: auto;
left: 0px;
right: 0px;
}
how can I set #parent
to grow and shrink in height with #child
.
I know that setting child to be absolutely positioned pulls it out of the regular flow so the parent element loses the ability to see the child's height, but is there any way I can clear it maybe like you would with a float?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…