CSS Absolute position DIV's question

manelmpereira
avatar
rank newbie

newbie


Posts: 1
Joined: 2008-07-23

Hello,

I've been having a few problems with nested div's, when absolute positioned.

I've tried a few solutions presented, but they were only directed towards div's which were floating left or right, never absolute positioned.

Here's an example of what I mean.

<html>
<head>
<style>
#container
{
   border: 1px solid red;
   width: 600px;
   padding: 15px;
}
#abs_left
{
   position: absolute;
   width: 400px;
   height: 200px;
   border: 1px solid blue;
}
#abs_right
{
   position: absolute;
   margin: 0 0 0 405px;
   width: 190px;
   height: 150px;
   border: 1px solid green;
}
</style>
</head>
<body>

<div id="container">
   <div id="abs_left"></div>
   <div id="abs_right"></div>
</div>

</body>
</html>

The div "container" doesn't expand to contain the div's "abs_left" and "abs_right".

Is there any solution? This is intended to be dinamically generated, so I cannot explicitly tell the container's height.

Thanks in advance!
Manuel