I am trying to create a two column webpage. The both columns have dynamic height, but I want both of them to extend 100% of the page.
What I mean is if you have a page
+------------------------+
| Header |
+------------------------+
| Col1 | Col2 |
| | |
| | |
| | |
+-------------+----------+
| footer |
+------------------------+
I want as you see above both columns to extend the entire height of the page.
Right now I have
<div id="main">
<div id="col1"></div>
<div id="col2"></div>
</div>
#col1 {float: left;}
#col2 {float: right;}
The issue is no matter what I try the only way I can have a column grow in height is by using a static number
#col2 {
float: right;}
height: 100px;
}
This does not work because the content is dynamic.
I have tried changing the floats and putting clears all over the place but no matter what I do my page ends up looking like this
+------------------------+
| Header |
+------------------------+
| Col1 | Col2 |
| | |
| | |
| +----------+
| | |
| | |
| | |
+-------------+----------+
| footer |
+------------------------+
Where column two is shorter than column one.
How do you have two side by side columns that extend the height of a page?
edit
I have gone threw and tried all the suggestions with no fruition. I want to add something. If there is a better way to do this without floats I am willing as well. For instance relative position. the only issue is the main div must be centered in the body which I cannot seem to get working with absolutes.