将底部边框添加到div [英] Add a bottom border to a div

查看:119
本文介绍了将底部边框添加到div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为div添加底边框

I am trying to add a bottom border to a div

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

但底边框不会显示为白色。任何想法?

However the bottom border does not appear white. Any idea?

推荐答案

您必须指定 border-bottom-style 也到div

You have to specify the border-bottom-style also to the 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 like below

or you can use a shorthand for the border-bottom like below

<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>

这适用于我

这篇关于将底部边框添加到div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆