html - 为什么我的页脚没有粘在底部?

标签 html css

body {
    background: #ffffff;
    color: #000;
    font-family: Verdana, Arial, Sans-Serif;
    font-size: 13px;
    text-align: center; /* IE 5 fix */
    line-height: 1.4;
height: 100%;
margin: 0;
padding: 0;
}

#container {
    width: 50%;
    background: #fff;
    border: none;
    color: #000000;
    margin: auto auto;
    padding: 20px;
    text-align: left; /* IE 5 fix */
overflow:auto;
padding-bottom: 180px
}

#wrap {
min-height: 100%;
}

#footer {
background: #000 url(images/cbf/foot.png) repeat;
border-top: solid 1px #000;
position: relative;
width:100%;
margin-top: -180px; /* negative value of footer height */
height: 180px;
clear:both;
}

忙了一整天,也许我的眼睛只是累得瞎了。

我也在 body 标签内合并了 wrap div,我清除了缓存并尝试了 Chrome 和 firefox。

最佳答案

试试这个

#footer {
background: #000 url(images/cbf/foot.png) repeat;
border-top: solid 1px #000;
position: fixed;
bottom: 0;
width: 100%;
height: 180px;
clear: both;
}

关于html - 为什么我的页脚没有粘在底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14825029/

相关文章:

html - 如何使下拉菜单在悬停时保持打开状态

javascript - 动态调整文本大小以填充 div

javascript - 如何将图像重新显示回来?

css - 在网格中格式化 div 高度

php - 在有内容的页面上触发文件下载

html - 让容器宽度与其第一个元素一样宽,其他元素保持最大尺寸

javascript - 如何从表中删除 DataTables 分页?

html - 我的 Div 只是与另一个 div 重叠,而我将它放在第一个 div 之后

javascript - 如何使用 Javascript 隐藏页面加载时的特定句子

html - flexbox 的增长是否受 flexbox-basis 的影响?