Reputation: 9527
I have a wrapper containing an inner wrapper, and that inner wrapper contains 2 floating divs. The left one contains more content than the right one, so it's height is greater than the one on the right. What I am looking for is that both of the containers would have the same height.
My html:
<div id="wrapper">
<div id="sub-menu">
<div id="left-column" class="column">
Agenda</br>
Here I put some texte
</div>
<div id="right-column" class="column">
sdfdsf
</div>
</div>
</div>
My css:
body{
background-color:#E5E5E5;}
#wrapper{
background-color:#FFFFFF;
width:800px;
margin-left:auto;
margin-right:auto;
overflow:auto;}
#sub-menu{
margin:10px;
width:780px;
position:relative;
float:left;}
.column{
float:left;
height:100%;}
#left-column{
width:500px;
background-color:yellow;}
#right-column{
width:280px;
background-color:magenta;}
Upvotes: 3
Views: 4400
Reputation: 6030
use a 1 pixel high repeating background image with 500 px wide yellow and 280 px wide magenta. When one column increases in size - you get the illusion of both columns being the same height.
<div class="backgroundColumn">
<div>
Left column
</div>
<div>
right column
</div>
<div class="clear">
</div>
</div>
Upvotes: 0
Reputation: 148
You cannot do this via CSS alone using floated elements, unless you can guarantee the height of each column (which you generally can't, with such a fluid medium as the web). However, you do have options:
display: table-cell
: http://jsfiddle.net/8LdQk/3/. Unfortunately, this will not work in IE6 or 7. This blog post detailing its use might be helpful.Upvotes: 6
Reputation: 16944
This seems to do the trick for me. Can it be that simple? :)
.column{float:left;height:100px;}
Upvotes: -1