我正在尝试为div添加底部边框
.divLast
{
top: 0px;
margin:0px;
padding: 0px 2px 2px 3px;
border-width: 2px;
border-bottom-width:2px;
border-bottom-color:White;
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
但是底部边框不会显示为白色.任何的想法?
rah*_*hul 43
您还必须为div 指定border-bottom-style
你的代码变成了
.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%;
}
Run Code Online (Sandbox Code Playgroud)
或者您可以像下面一样使用边框底部的速记
<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>
Run Code Online (Sandbox Code Playgroud)
这对我来说很好
这是因为您需要说明边框样式.如果没有这个,边框就不会显示:
border-bottom-style:solid;
Run Code Online (Sandbox Code Playgroud)
你也可以将你的declerations组合成一个如下:
border-bottom:2px solid White;
Run Code Online (Sandbox Code Playgroud)