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

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

    This is what worked for me: When I tried bottom 0 and right 0, there was some annoying bottom margin below the footer which would not go away. I fixed it with top: 100% and position absolute:

    body{
    height: 100%;
    width: 100%;
    position: relative;
    
    }
    
    footer{
    background-image: linear-gradient(to right, #c10f3f, #010168);
    padding: 1em;
    width: 100%;
    top: 100%;
    position: absolute;
    }
    

提交回复
热议问题