Hi Ahmed Sadman. Welcome to the forums.
Firstly, don't use position: absolute for page layout (except for small items that are not part of the main page flow. The reason is that absolute elements are taken out of the "flow" of the page, meaning that other elements don't "see" them and thus do not respond to them (such as when they grow in size). That's why the container is closed when the inner element is absolute, because the container think it has nothing inside it, so it closes up to nothing—unless, of course, you give it a fixed height (which is almost always a bad idea anyway).
You should indeed be using float on the inner element. But as with absolutely positioned elements, a container doesn't wrap around a floated element by default. You have to tell the container to wrap around the floated item. The easiest way to do that is with overflow: hidden. So try this:
Code:
div#container {
width: 80%;
margin: 0 auto;
overflow: hidden;
}
div#container div#content, header {
float: left;
}
div#content {
width: XXXpx;
padding: 0 0 0 0;
}
header {
width: XXXpx;
padding: 0 0 0 0;
}
Make sure to set a width on each floated element, or it won't float, and you can also set padding/margin to suit. Be aware, though, that left and right padding/margin are added to the overall width.
Hope that helps.

Bookmarks