Search code examples
csssticky-footer

When creating CSS sticky footers, why use min-height and not just height?


I'm reading about making footers stay at the bottom of the browser with CSS, and every time I read about making the and 100% height, and then make the / div or whatever you want to call it have min-height 100%. That way, if the content doesn't take up enough room, the does not collapse, bringing your footer up with it. My question is why does everyone say use min-height 100% for and not just plain old height 100%? Would that mean the could never get bigger than 1 window's worth of view in the browser (in other words, would never get tall enough to need a scroll bar)? 100% height to me makes me just think that the div would just take up 100% of the browser height. Isn't that what we want?


Solution

  • Would that mean the could never get bigger than 1 window's worth of view in the browser (in other words, would never get tall enough to need a scroll bar)?

    Yes.

    The footer will stay there at the 100% height and the content will spill over it down the document.

    Just try it.