Stick Footer to bottom not work in Chrome (does in IE, Firefox, Safari)

大憨熊 提交于 2019-12-11 15:47:05

问题


At http://ryanspahn.com/adsgrader2/index you can see I have a grey footer and in IE, Safari and Firefox the footer sticks to the bottom. But in Chrome it is not sticking to the bottom - which is odd.

I created this sticky footer using the following method found here on stack ...... CSS to make HTML page footer stay at bottom of the page with a minimum height.

I wonder if anyone has seen this before and or has a suggestion to fix this Chrome issue.


回答1:


I'm not sure about that tutorial but if you want your footer to stay at the bottom you need to use fixed positioning not relative. Fixed means that it will not scroll when the rest of the page scrolls. You can anchor it with the same attributes at absolute positioning using top, bottom, left, right.

Add the following onto your existing css, and change values where necessary.

#footer {
     position: fixed;
     bottom: 0px;
     width: 100%;
}

#foot {
    margin: 0px auto;
}

I also noticed that when you do this you'll have to float the image you have in the footer left.

#right img {
    float: left;
}


来源:https://stackoverflow.com/questions/5740512/stick-footer-to-bottom-not-work-in-chrome-does-in-ie-firefox-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!