Possible Duplicate:
2 divs in a larger div must equal the same height… but how?
I’m having trouble auto setting the height of my containerLeft div (red background) the same height as my containerRight div. I specifically want this to stay a fluid grid.
jsfiddle here: http://jsfiddle.net/s7ufg/
If you know that one of the two columns is always going to be taller than the other, then you can do something like this:
demo
Just give
position: absoluteto the shorter column and make it stretch fromtop: 0tobottom: 0.HTML:
CSS:
If you don’t know for sure which one of them is going to be taller, then you can simulate the fact that they are of equal
heightby using a background gradient on their parent.demo
HTML is the same, CSS becomes:
However, CSS gradients don’t work in IE9 and older, so if you want a solution for IE8+, then you can try this
demo
which uses
:beforeand:afterpseudo-elements.