How to anchor a DIV to the bottom of a page?

前端 未结 2 473
梦谈多话
梦谈多话 2020-12-28 15:02

I have a fixed-width DIV that I want to remain at the bottom of the browser\'s viewport.

Unfortunately, I haven\'t a clue where I would even begin to try to implemen

相关标签:
2条回答
  • 2020-12-28 15:22
    #mydiv{
       position: fixed;
       bottom: 0px;
    }
    
    0 讨论(0)
  • 2020-12-28 15:35

    See at css-tricks:

    Fixed Footer

    CSS:

    #footer {
       position:fixed;
       left:0px;
       bottom:0px;
       height:30px;
       width:100%;
       background:#999;
    }
    
    /* IE 6 */
    * html #footer {
       position:absolute;
       top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
    }
    
    0 讨论(0)
提交回复
热议问题