I'm trying to make a 2 column design (using Twitter Bootstrap) with 2 columns of equal height.
Let's take this example:
<div class="row-fluid">
<div class="span2">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
</div>
<div class="span10">
test
</div>
</div>
Because .span2
is the highest of the two columns, it makes .row-fluid
stretch to accommodate its height.
After reading this article, I was expecting that setting min-height: 100%
on .span10
would make it stretch to the full height, but it doesn't:
http://jsfiddle.net/WTNeB/1/
Why is that? Any solution to make .span10
stretch to its parent height, avoiding setting a fixed height, to keep this design flexible?
Try this:
http://jsfiddle.net/WTNeB/2/
notice that i added display:table
and display:table-cell
but also I changed the css selector names so that it gets the priority needed.
.row-fluid {
border: 1px dotted gray;
display: table;
}
.row-fluid .span2 {
border: 1px solid blue;
display: table-cell;
float: none;
}
.row-fluid .span10 {
min-height: 100%;
border: 1px solid red;
height: 100%;
display: table-cell;
float: none;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With