Jul
10

Height 100% with divs.

By rzelazko  //  CSS Tricks  //  No Comments

If you need set height of one div as long as other div (both div float left) you must do some tricks.

Base code:

1
2
3
#wrapper { clear: both; }
#cola { float: left; width: 100px; }
#colb { float: left: width: 100px; }
1
2
3
4
<div id="wrapper">
  <div id="cola"></div>
  <div id="colb">Some content.</div>
</div>

Now if you want to have same height in cola and colb you must add:

1
2
#wrapper { overflow: hidden; }
#cola { margin-bottom:-32767px; padding-bottom:32767px; }

Leave a comment