Forum Moderators: not2easy
I have three divs vertically stacked together occupying 100% of the container div like so:
div1 height = 8%
div2 height = 89%
div3 height = 3%
When there are no top or bottom borders in any of these divs things work fine. But if any top or bottom border is added the divs together overshoot the containing div. Can someone please explain why this happens!
Thanks a bunch!
Take a look at the standard:
[w3.org...]
Padding and borders add to the size of the box
Outlines don't take up space, perhaps they might help you.
i.e. the total height space taken up = margins + borders + padding + content
If you start with height:100px then add a 1px top border, you need to reduce your content height to 99px if you want the total height to be 100px.
Thanks!
There's no way to combine % and px so that the total adds up to a nice pretty %. I suggest that you try one or more of the following:
<div (container) style="position:relative">
-<div (first)>content1</div>
-content2
-<div (third) style="position:absolute;bottom:0px">content3</div>
</div>