Position Absolute and Bottom 0

后端 未结 2 1299
悲&欢浪女
悲&欢浪女 2020-12-09 03:13

http://cdpn.io/FykHr I seem to have an issue with the combined CSS properties:

position: absolute;
bottom: 0;

First you can see that the .f

相关标签:
2条回答
  • 2020-12-09 04:08

    You need to add position: relative; to the parent container, which in this case is .wrapper.

    Here's a good reference page on absolute positioning.

    0 讨论(0)
  • 2020-12-09 04:16

    There is one way to do that:

    body {
        height: 100%;
        margin: 0;
    }
    html {
        padding-bottom: 50px;
        min-height: 100%;
        box-sizing: border-box;
        -moz-box-sizing: border-box;
        position: relative;
    }
    
    footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        background-color: red;
    }
    

    http://jsfiddle.net/n8UNM/

    There is still one limitation. You have to know height of footer and set it in two places.

    0 讨论(0)
提交回复
热议问题