2013-12-19 44 views
2

基本上我在div的底部找到了我喜歡的文本,但問題在於它是左對齊,我希望它位於div的中心。居中對齊文本到div的底部

CSS3

#article-footer { 
    width: 100%; 
    margin: 0 auto; 
} 

#article-footer { 
    position: relative; 
    width: 70%; 
    float: left; 
    font-weight: bold; 
    font-size: 23px; 
    color: #354175; 
} 

#article-footer span{ 
    position:absolute; 
    bottom: 0; 
} 
+0

使用文本對齊:中心爲 – Rex

+1

你有HTML代碼? –

+0

是的HTML5,但CSS幾乎可以解釋它,文本只是三個字「買*賣*貿易」 – SecretWalrus

回答

5
#article-footer span{ 
position:absolute; 
bottom: 0; 
left:50%; 
margin-left:-50%;} 
+0

沒有工作,試過了一會兒。 – SecretWalrus

+0

然後,你應該看到什麼規則覆蓋它。使用'!important'是一個壞主意 – n1kkou

+0

使用這段代碼的一個版本進行了編輯了一下。謝謝您的幫助。 – SecretWalrus

1

使用此

text-align: center !important ; 
+1

這是有效的,我通常不喜歡使用!重要的規則,如果我能避免它,因爲它可能會使任何人想在將來改變我的代碼更加困難。 – SecretWalrus