我使用Flask/Jinja2块来创建HTML。我遇到了这个问题 我的脚注在中间。在内容较少或没有内容的页面中,它看起来不错(在底部)。我什么都试过了。在
以下是HTML和CSS:
h1, h2, h3, h4 { font-family: Sansita, serif }
p { font-size: smaller }
ul { position: relative; top: 25px; right: 25px }
footer{ position: absolute; width: 100%; background: aliceblue; bottom: 0; height: 50px}
^{pr2}$
你的问题是
position: absolute
。这将把项目准确地放在它所说的地方,即屏幕的底部。如果内容溢出,则页脚保持不变。你真正想要的是position: fixed
你的页脚在绝对位置。 所以使用位置:固定和将您的css构建为以下格式:
如果你想要一个与IE6兼容的css别忘了这么做。在
^{pr2}$您也可以删除页脚中的br。更喜欢在这个用例中使用填充顶部。干净多了。在
相关问题 更多 >
编程相关推荐