我需要将我的页脚固定到页面底部并使其居中.页脚的内容可能会一直发生变化,因此我无法通过margin-left将其居中:xxpx; margin-right:xxpx;
问题是由于某种原因,这不起作用:
#whatever {
position: fixed;
bottom: 0px;
margin-right: auto;
margin-left: auto;
}
Run Code Online (Sandbox Code Playgroud)
我抓了网,一无所获.我试着制作一个容器div和nada.我尝试了其他组合和gurnisht.我怎样才能做到这一点?
谢谢
我正在写一个页面底部有固定页脚的网页.页面的内容具有特定的宽度并居中.页脚也有特定的宽度,必须居中.
问题:
postiton: fixed- 页脚不居中z-index几乎没有修复它,因为我在背景设置上有一个像身体背景一样的渐变.所以我需要像float: bottom......
我知道粘性页脚.但我的情况是,我正在开发一个将用于PC和移动设备的网站.因此,显示的页脚由屏幕宽度调整.
页脚的高度会在每个分辨率上发生变化.
任何人都可以知道如何在页面底部(而不是屏幕)显示页脚.某些页面的高度很小,页脚显示在页面之间.
我有以下结构:
<body style="height:100%;">
<div style="height:100%;">
<div id="wrapper" style="height:100%; max-width:800px;">
<div id="header">
some content
</div>
<div id="content">
some content
</div>
<div id="footer" style="position:relative; width:100%;">
some content
</div>
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)