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

前端 未结 9 1049
温柔的废话
温柔的废话 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:12

    the answer posted by @divy3993 works but sometimes making footer absolute keeps it stranded on the middle of the page. Atleast that's what had happened to me. So I made a small change, I'll post it below

    #footer {
      background: #ffab62;
      width: 100%;
      height: 100px;
      position: relative; //make relative instead of absolute
      bottom: 0;
      left: 0;
    }
    

提交回复
热议问题