css - 页脚不会粘在底部

标签 css footer

我尝试按照教程找到here 让我的页脚粘在浏览器窗口的底部。我已经多次检查了教程,看来我的结构正确。然而我的页脚仍然悬停在窗口上方大约 30 像素处。被困在这个问题上几天了,我没有任何想法,所以任何帮助都会很棒:)

<div class = "wrapper">
  <div id='cssmenu'>
  </div>


  <div id="header">
    <h1>My header</h1>
  </div>
  <div class="content">Some content
  </div>
  <div class="push">
  </div>
</div><!-- end wrapper -->


<div class="footer">Footer with images
</div>



* {
margin: 0;
}

html, body {
height: 100%;
}

body {
padding: 0;
margin: 0;
font-family: 'Open Sans', sans-serif;
background-color: #FCFDFF;
font-size: 18px;
}

.content
{
  padding: 0% 0% 0% 20%;
  width: 65%;
  line-height:1.7em;
  background-color: #FCFDFF;

}


.footer, .push {
height: 4em;
clear: both;
}

.footer {
  background-color: #000;
}

.footerImages {

padding: 5px 5px 5px 1px;
    float: right;
}

最佳答案

为什么不直接做

.footer {
    position: fixed;
    bottom: 0;
}

这将为您提供一个粘在窗口底部的页脚,这就是您根据问题所想要的。

关于css - 页脚不会粘在底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25231585/

相关文章:

android - 在 xml 的 ListView 中添加页眉/页脚

html - 将页脚停靠在主 Div 之外的底部

jquery - 列宽设置 - HTML 表格

javascript - Fancybox V2 fit content width iframe

html - 在CSS中,元素的 "margin"对其父元素的 "height"没有影响?

css - 这个页脚留在 Chrome 中,我怎样才能让它在 Firefox 中保持不变

html - 底部的页脚与 css 网格?想不通?

html - 如何使具有许多 div 结构的网页内容居中

html - 如何用CSS制作一个带标题的盒子?

css - 输入不同颜色星号的占位符?