Calius
05-16-2006, 09:27 PM
Hello
I have a DIV (let's call it "the parent") which contains three child DIVs. Each of the children has some text in it. Neither the parent nor any of the three children have any special positioning attributes applied to them, and so the parent sizes just so that it wraps the children. So far so good.
Now I want another DIV child, which when visible will completly fill the parent (using the size the parent now has because of its other three children, not stretching the parent in any way).
I tried giving the parent "position:relative", and giving this fourth child "position:absolute; top:0; left:0; width:100%; height:100%", which works fine in FF but doesn't work in IE. I tried also "bottom:0; right:0" instead of the "width:100%; height:100%", still to no avail.
Is there a way to make this work in IE?
Is there maybe another way to make this without absolutely-positioning the fourth DIV?
Cheers,
Calius
<html>
<body>
This is a test<br />
<div style="width:400px; position:relative; border:1px solid red;">
<div style="position:absolute; background-color:green; height:100%; left:0; top:0; width:100%;">COVER ALL</div>
<div style="border:1px solid blue; margin-bottom:16px;">1</div>
<div style="border:1px solid blue; margin-bottom:16px;">2</div>
<div style="border:1px solid blue;">3</div>
</div>
This is a test<br />
</body>
</html>
I have a DIV (let's call it "the parent") which contains three child DIVs. Each of the children has some text in it. Neither the parent nor any of the three children have any special positioning attributes applied to them, and so the parent sizes just so that it wraps the children. So far so good.
Now I want another DIV child, which when visible will completly fill the parent (using the size the parent now has because of its other three children, not stretching the parent in any way).
I tried giving the parent "position:relative", and giving this fourth child "position:absolute; top:0; left:0; width:100%; height:100%", which works fine in FF but doesn't work in IE. I tried also "bottom:0; right:0" instead of the "width:100%; height:100%", still to no avail.
Is there a way to make this work in IE?
Is there maybe another way to make this without absolutely-positioning the fourth DIV?
Cheers,
Calius
<html>
<body>
This is a test<br />
<div style="width:400px; position:relative; border:1px solid red;">
<div style="position:absolute; background-color:green; height:100%; left:0; top:0; width:100%;">COVER ALL</div>
<div style="border:1px solid blue; margin-bottom:16px;">1</div>
<div style="border:1px solid blue; margin-bottom:16px;">2</div>
<div style="border:1px solid blue;">3</div>
</div>
This is a test<br />
</body>
</html>