Using CSS2.1 only, Work with all browsers (IE8+), without specifying any height or width.
That means that if your header suddenly grows longer, or your left navigation needs to enlarge, you don't have to fix anything in your CSS.
Totally responsive, simple & clear and very easy to manage.
<div class="Container">
<div class="Header">
</div>
<div class="HeightTaker">
<div class="Wrapper">
<div class="LeftNavigation">
</div>
<div class="Content">
</div>
</div>
</div>
</div>
Explanation:
The container div
takes 100% height of the body, and he's divided into 2 sections.
The header section will span to its needed height, and the HeightTaker
will take the rest.
How is it achieved? by floating an empty element along side the container with 100% height (using :before
), and giving the HeightTaker
an empty element at the end with the clear rule (using :after
). that element cant be in the same line with the floated element, so he's pushed till the end. which is exactly the 100% of the document.
With that we make the HeightTaker
span the rest of the container height, without stating any specific height/ margin.
inside that HeightTaker
we build a normal floated layout (to achieve the column like display) with a minor change.. we have a Wrapper
element, that is needed for the 100%
height to work.
Here's the Demo with Bootstrap classes. (I just added one div to your layout)