2013-02-12 134 views
0
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; 
} 

一整天都在工作,也许我的眼睛只是因为疲惫而失明。为什么我的页脚不能粘在底部?

我已经将wrap div包含在body标签中,我也清除了我的缓存并尝试了Chrome和Firefox。

+3

“IE 5修复”?在2013年? – 2013-02-12 03:45:19

+0

页脚出现在我的底部,你可以定义你正在寻找更详细的内容 – 2013-02-12 03:45:38

+0

哇,IE 5修复! – 2013-02-12 03:46:01

回答

1

您是否尝试过向页脚添加bottom:0;

::编辑::不太确定如果你是在谈论整个页脚或只是文本。如果你想要在底部的文本,给它一个新的div /类,并设置底部:0;它会放在那里为你。如果您希望整个页脚位于最下方,则它已经位于我的Firefox和Chrome中。

:: EDIT2 ::

#copyright { font: 11px Verdana, Arial, Sans-Serif; bottom: 0; padding: 10px 0 0 0; } 

如果你想在底部的链接也将它们添加到版权格为好。

这里是你的页脚:

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

我做了,但没有改变,除非我将位置从相对位置改为固定位置。但是,当浏览器很小时,这会使页脚滚动。 – Vernard 2013-02-12 03:54:39

+0

你可以把它放下来,我可以看到你在说什么吗? – Dan88 2013-02-12 03:56:24

+0

它是活的,它使用bottom:0px;我改变了posistion:相对于固定。 – Vernard 2013-02-12 03:59:07

1

试试这个

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

出于好奇,我们为什么要添加位置:固定; ? – Vernard 2013-02-12 03:52:06

+0

职位:固定;工程,但是当我最小化浏览器页脚跟随滚动。任何工作? – Vernard 2013-02-12 03:54:09

+0

由于固定位置与底部一起:0;告诉浏览器将该元素放置在浏览器窗口的底部,无论如何。 – jacobt 2013-02-12 03:54:44

0

我觉得这个级难题试试下面chanegs ...我希望这应该是工作......

#copyright { 
    border: 0 none; 
    bottom: 0; 
    font: 11px Verdana,Arial,Sans-Serif; 
    margin: 0; 
    padding: 10px 0 0; 
    position: relative; 
    top: 110px; 
0

好像你的页脚高度设置为180px,这会在代码height: 180px中产生问题。

它应该是height: 60px