HTML footer problem

2019-03-25 11:05发布

Is it possible to create a footer div that sits at the bottom of a site regardless of how much information is present in the middle?

Currently the div I have is positioned depending on how much content i have in the body.

See also:

How do you get the footer to stay at the bottom of a Web page?

标签: html footer
4条回答
淡お忘
2楼-- · 2019-03-25 11:28

I am by no means a css expert, but this works for me across the major browsers:

.d_footer
{
    position:fixed;
    bottom:0px;
    background-color: #336699;
    width:100%;
    text-align:center;
    padding-top:5px;
    padding-bottom:5px;
    color:#ffffff;
}
查看更多
你好瞎i
3楼-- · 2019-03-25 11:38

JonathanMueller is right, that works perfectly.

I had been looking through posts trying to do it like this. All I could find was fixed to the bottom of the window. Thanks!

查看更多
甜甜的少女心
4楼-- · 2019-03-25 11:41

I know I marked this as being answered but I've run into another problem as a result. The footer sits nicely at the bottom of the page, however, if the content goes past the footer, the footer simply floats over the content.

Is there a way to keep the footer at the bottom of the page without it overlapping if the content goes past the bottom?

My gut feel is using an iframe but Im not sure how to do it.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-03-25 11:46

Float the content div and have the footer div use clear: both.

查看更多
登录 后发表回答