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

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

    You may try this styling;

    html, body {
        height: 100%;
    }
    .wrapper {
        min-height: 100%;
        margin-bottom: -100px;
        padding-bottom: 100px;
    }
    header {
        position: absolute;
        float: top;
        width: 100%;
        height: 8%;
        background-color: #424242;
        color: #FFD740;
    }
    .title-div {
        position: absolute;
        height: 100%;
        margin: auto 5%;
        padding-right: 3%;
        border-right: solid 2px #FFD740;
    }
    
    header nav {
        position: absolute;
        width: 75%;
        left: 15%;
    }
    
    header ul {
        list-style: none outside none;
    }
    
    header ul  li{
        display: inline-block;
        margin: auto 2% auto 0; 
    }
    footer {
        height: 100px;
        padding-top: 15px;
        padding-left: 15px;
        color: #FFD740; 
        background-color: #424242;
    }
    

    Here is a demo

提交回复
热议问题