Using two types of dimensions with a div (css only?)

I have a div that I need to take 100% of the page, except for the xnumber of pixels. I can not use JavaScript, is this possible?

I can set the height like this:

height:100%;

or I could set it as:

height:0px;

But how can I subtract xpixels one hundred percent ?

EDIT

This is why I need to do this:

You will notice that the footer is divided into div. Can I do anything about this?

+3
source share
2 answers

Live demo

Using position: absolute;, you can!

+5
source

This cannot be done using native CSS. You need to either use two divs or padding:

<div style="height:100%; position: relative;">
    <div style="position: absolute; top: 0; left: 0; right: 0; bottom: 5px;">
    </div>
</div>

OR

<div style="height:100%; padding-bottom: 5px;">
</div>

( , CSS , ..)

+3

All Articles