底部边框添加到一个div

问题描述:

我试图底部边框添加到一个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%; 
} 

但是底部边框不会出现白色。任何想法?

你也必须指定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

这是因为你需要t o说明边框风格是什么。如果没有这种边框不会显示:

border-bottom-style:solid; 

您还可以结合您的declerations成一个像这样:

border-bottom:2px solid White;