If you know that one of the two columns will always be higher than the other, then you can do something like this:
Just give position: absolute to the shorter column and stretch it from top: 0 to bottom: 0 .
HTML
<div class='container'> <div class="containerLeft"> <h2>1.</h2> <p>First, let play a video.</p> </div> <div class="containerRight"> <img src="http://tctechcrunch2011.files.wordpress.com/2012/09/michael-headshot-red.jpg?w=288" /> </div> </div>โ
CSS
.container { position: relative; } .containerLeft { position: absolute; top: 0; bottom: 0; left: 0; width: 38%; padding: 2%; background-color: crimson; } .containerRight { margin: 0 0 0 42%; width: 58%; background: dodgerblue; }โ
If you donโt know exactly which one will be higher, you can simulate the fact that they are equal to height using a gradient background for your parents.
HTML is the same, CSS becomes:
.container { overflow: hidden; background: -webkit-linear-gradient(left, crimson 42%, dodgerblue 42%); background: -moz-linear-gradient(left, crimson 42%, dodgerblue 42%); background: -o-linear-gradient(left, crimson 42%, dodgerblue 42%); background: linear-gradient(left, crimson 42%, dodgerblue 42%); } .containerLeft, .containerRight { float: left; } .containerLeft { width:38%; padding: 2%; } .containerRight { width: 58%; }โ
However, CSS gradients do not work in IE9 and later , so if you want a solution for IE8 +, you can try this
which uses :before and :after pseudo-elements .
.container { overflow: hidden; position: relative; } .container:before,.container:after { position: absolute; z-index: -1; top: 0; bottom: 0; content: ''; } .container:before { left: 0; width: 42%; background: crimson; } .container:after { right: 0; width: 58%; background: dodgerblue; } .containerLeft, .containerRight { float: left; } .containerLeft { z-index: 2; width:38%; padding: 2%; } .containerRight { width: 58%; }โ