Fluid height div INCLUDING margins?

Myler

the horror.
Apr 25, 2009
531
6
0
G16
I have a div with blocks of text. Sometimes 4 paragraphs, sometimes 44.

I set the div height to height:100%:

The text within the div has a bottom margin of 1em, to make the paragraphs space nicely without me putting <br> or similar stuff in the code.

The problem is, the bottom margin pushes the div that comes after this one. It makes a 1em space because of the text bottom margin.

Is there a way to make the text div stretch to 100% INCLUDING the margin space?
 


you may be able to work out something using min-height instead of height, and possibly line-height with or instead of bottom-margin
 
The content box does not change height according with the viewport height (browser window height) like a width does. I don't understand your question but you will have to give the last paragraph or item a "last" class that specifically offers a zero (or whatever) margin/padding.

You may also use absolute positioning on the div(s) that come after but this is highly unrecommended. Email me if you still can't get this working and I'd be happy to see what's up.