2016-02-03 84 views
-3

我定義了這個CSS類並將其應用於一行文本,並希望它位於頁面的最底部,但它不是。它漂浮在頁面中間。有什麼問題?CSS margin-bottom屬性不起作用

#bottom {   
    margin: auto; 
    margin-bottom:0px; 
} 

HTML:

<div id="bottom"> 
    <a href="/bword/index.jsf;jsessionid=fc87GyPawnkaIWb_y6ig9Zsmo9aa9wbaizVNFAE7.localhost">Privacy policy</a>  
</div> 
+0

哪裏HTML? –

+0

它在外部CSS文件中定義。 – ling

+0

這很好,但CSS本身沒有意義。它僅在正在呈現的HTML文件的上下文中具有含義。沒有看到您嘗試顯示的HTML,就無法回答您的問題。 –

回答

0

我認爲,你想要做的是一個文本堅持到頁面的底部。 所以CSS應該看起來像

#bottom { position:fixed; bottom: 0px; } 

但是,如果沒有更詳細的描述,我不知道,如果這是你想要做什麼。

保證金不是用於的財產。也許看看到這裏的描述:

http://www.w3schools.com/css/css_margin.asp

1
#bottom { 
    bottom: 0; 
    left: 0; 
    position: fixed; 
    right: 0; 
    text-align: left; 
} 

這將解決你的問題

+0

這確實有效,但我更改爲「text-align:center」。爲什麼我需要「left:0」和「right:0」? – ling