2012-09-01 27 views
0

我有一個頁腳定義爲字體變化和自動調整加填充

div#footer { 
    width:100%; 
    bottom:0; 
    background:url(../images/bg_footer0.png) repeat-x; 
} 

其HTML體設計爲

html,body { 
    margin:0; 
    padding:0; 
    height:100%; 
    font-family:arial, Helvetica, sans-serif; 
    color:#666; 
    background:url(../images/bg_body.png) repeat-x; 
    font-size:12px; 
} 

但是當我改變arialserif在字體,頁腳從底部填充,我想這在所有字體變化中都很常見。但是爲什麼以及怎樣才能始終將頁腳添加到底部,無論發生什麼變化?

+0

你能元素絕對位置文本底部:0;或者你可以調整行高; –

+1

'bottom:0'''如果'position:static'沒有效果' – Oriol

+0

它可能是'line-height',嘗試將其設置爲固定值並查看會發生什麼。字體有不同的x高度。 – Maroshii

回答

0

試試這個

 div#footer { 
      width:100%; 
      bottom:0; 
      background:url(../images/bg_footer0.png) repeat-x; 
      position: absolute; 
     } 

其實你可以選擇它只是

  #footer{} 

,除非你有其他類型的與頁腳相同的ID,這將是壞

+0

謝謝Scott,我只有一個頁腳。我意識到使用背景頁腳圖片是一個不好的方法,我會嘗試使用簡單的div並添加邊框和顏色 –

+0

不,後臺圖片應該沒問題,但是這個絕對位置應該固定你在底部的小頁邊距,如果出於某種奇怪的原因,它不應該使用bottom:-2px; –