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

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

    I'm using Bootstrap 4 and this worked for me: https://www.youtube.com/watch?v=yc2olxLgKLk

    I did this way in the CSS file (base.css):

        html {
            height: 100%;
        }
    
        body {
            min-height: 100%;
    
            display: flex;
            flex-direction: column;
        }
    
        footer{
            padding: 3em;
            margin-top: auto;
        }
    

    And I've linked the css file in the html (base.html):

    
        
    
    

提交回复
热议问题