How to stick footer to bottom (not fixed) even with scrolling

前端 未结 9 1051
温柔的废话
温柔的废话 2021-02-03 20:53

I\'m learning web development and I simply can\'t figure out what I\'m doing wrong on this. I want the footer of this page to stick to the bottom, below all content, but not fix

9条回答
  •  清歌不尽
    2021-02-03 21:11

    Your first mistakes are just using absolute position on everything and min-height on many stuff you don't need.

    For starter just remove all absolute stuff and put min-height only in div named "body" after that footer will be glued to the #body by default, after that your footer won't be flying around where ever it wants.

    Best way to use absolute in divs is: - when you already have existing div with relative position, and then you put another div with an absolute position inside of a div with a relative position.

    Also, play only with pixel values if you start going with % you will get lost like you already did.

提交回复
热议问题