Click to See Complete Forum and Search --> : Child expansion i parent div


dalpe
06-27-2007, 04:31 AM
Hi,

I have two child divs in a parent div.
One of the childs, namely "child2" will expand the parent div, namely "main".
My objective is to make sure that "child1" also expands the entire height of "main".
See my code below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html style="height:100%">
<head>
</head>
<body style="margin:0;padding:0;">
<div id="main" style="height:100%;background:red">
<div id="child1" style="height:100%;background:blue;width:100px;float:left">
hello world!
</div>
<div id="child2" style="height:100%;background:green;width:100px;float:left">
this<br/>
text<br/>
expands<br/>
the<br/>
child2<br/>
and<br/>
parent<br/>
div
</div><br style="clear:both"/>
</div>
</body>
</html>

Is there a way to acheive my objectives?

Best regards
Peter

sticks464
06-27-2007, 07:18 AM
See http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/

dalpe
06-27-2007, 07:36 AM
Thanks for your reply sticks.

I take it it's not possible to acheive the objectives in a satisfying way, since the information on the mentioned link was different faux methods.
I'm allready using the first of those three methods: http://www.alistapart.com/articles/fauxcolumns/
to trick the reader into believing the columns and the graphics go hand in hand.

However, the solution seem unsatisfying to an old programmer as myself. But i guess that's life when it comes to web development, aye :(

Once again, thanks for your quick reply!

Best regards
Peter