2009-12-28 205 views
14

我試圖底部邊框添加到一個div底部邊框添加到一個div

.divLast 
{ 
    top: 0px; 
    margin:0px; 
    padding: 0px 2px 2px 3px;  
    border-width: 2px; 
    border-bottom-width:2px; 
    border-bottom-color:White; 
    width: 100%; 
} 

但是底部邊框不會出現白色。任何想法?

回答

38

你也必須指定border-bottom-style到div

和你的代碼變得

.divLast 
{ 
    top: 0px; 
    margin:0px; 
    padding: 0px 2px 2px 3px;  
    border-width: 2px; 
    border-bottom-width:2px; 
    border-bottom-color:White; 
    border-bottom-style: solid; 
    width: 100%; 
} 

,或者您可以使用簡寫border-bottom像下面

<style> 
.divLast 
{ 
    top: 0px; 
    margin:0px; 
    padding: 0px 2px 2px 3px;  
    border-width: 2px; 
    border-bottom: 2px white solid; 
    width: 100%; 
} 
</style> 
<div class='divLast'> 
    test element with white border bottom 
</div> 

這工作正常對我來說

+0

感謝你的最好的建議 – ScG 2009-12-28 12:32:20

7

這是因爲你需要t o說明邊框風格是什麼。如果沒有這種邊框不會顯示:

border-bottom-style:solid; 

您還可以結合您的declerations成一個像這樣:

border-bottom:2px solid White;