简体   繁体   English

带有“bottom:0”CSS 属性的页脚

[英]Footer with "bottom:0" CSS attribute

I have difficulties sticking a footer at the end of each pages without showing a bottom margin on very big resolutions (2560x1440 for instance).在非常大的分辨率(例如 2560x1440)下,我很难在每页的末尾粘贴页脚而不显示底部边距。

When used as "position:absolute" element it works fine on small heights pages such as http://www.perfect-profile.fr/mesdames Unfortunately, when on big heights pages, the footer will stays in the middle of the page : http://www.perfect-profile.fr/prix当用作“位置:绝对”元素时,它在小高度页面上工作正常,例如http://www.perfect-profile.fr/mesdames不幸的是,当在大高度页面上时,页脚将停留在页面中间: http://www.perfect-profile.fr/prix

I tried "position:relative" and that's the opposite : it show at the end of the content on big heights pages and keeps a margin in the bottom on small heights pages.我尝试了“位置:相对”,结果正好相反:它显示在大高度页面内容的末尾,并在小高度页面的底部保留边距。 I could determine a section min-height but the result would be hasardous on big resolutions.我可以确定一个部分的最小高度,但结果在大分辨率上会很麻烦。

Do you have any clue what I could do ?你知道我能做什么吗? Thanks谢谢

You need to use:您需要使用:

position:fixed

and your footer will stay at the bottom of the viewport...并且您的页脚将停留在视口的底部...

Well, as it seemed trickier than expected I had no other choice than to rethink the display.好吧,因为它看起来比预期的要棘手,所以我别无选择,只能重新考虑显示器。

I used a "position:fixed" and "bottom:0" footer to put it at the very bottom of the viewport no matter how much content the pages have.无论页面有多少内容,我都使用“位置:固定”和“底部:0”页脚将其放在视口的最底部。 Not what the client expected but that does the trick.不是客户所期望的,但这可以解决问题。

Thanks everyone for trying to help me on this one.感谢大家在这个问题上试图帮助我。 Problem solved.问题解决了。

<style>
footer
{
position:absolute;
bottom:0;
width:100%;
}
</style>

you have to set footer position fixed or absolute你必须设置页脚位置固定或绝对

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM