2013-02-12 88 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