I have a scrolling browser window with two div full of text,
at the bottom of the page there is a div with an image with a given height and a width to 100% like this.
This situation it’s OK when the content of the entire document is higher than the screen height, like this:
I want to keep that #bottom_div to the bottom also when the content of the entire document is small,
and here the browser window is not scrolling anymore. like this:
(also keeping a “min-margin” between the two divs, in case I reduce the browser window)
all these divs aren’t positioned with absolute positioning. the structure of the page is like this:
I have tried positioning the #bottom_div as absolute (but I’m not using absolute in the entire document) with bottom:0 but doing this
the div is fixed to the bottom but remain to the same position also when you scroll the window hiding the text below.
I have a second question about one thing that I see during coding:
try to comment in the html document “empty_div” and “bottom_div” and in the css “margin-top: -70px”.
-> So why the “div_1” produce a scrolling in the browser?
It seems that “outer” goes down with 15px and not “div_1”. why this?
But adding an element above “div_1”, even if you add a simple border to outer, all it’s ok.
Can you tell me something more about this situation?
Because of MARGIN COLLAPSE. VERTICAL MARGINS ( top/bottom) of NON POSITIONED, NON FLOATED ELEMENTS MERGE into each other UNLESS there is something like padding or borders between the two elements.