border-bottom-width属性用于设置一个元素的底部边框的宽度。
一个元素底部的边框宽度可以使用<length>值来明确指定,也可以使用三个预定义的关键字来指定:thin、medium和thick。
官方语法
border-bottom-width: <length> | thin | medium | thick
参数:
<length>:指定边框的宽度,不允许为负值。thin:预定义边框宽度。medium:预定义边框宽度。thick:预定义边框宽度。
border-bottom-width属性的初始值为medium。
注意:border-bottom-width属性的初始值为medium,但是元素的border属性的初始值为none,其宽度为0。
下面是border-bottom-width属性取值的示例代码:
/* 可以是任何 <length> 值 */
border-bottom-width: 10em;
border-bottom-width: 3vmax;
border-bottom-width: 6px;
/* 可以是预定义关键字 */
border-bottom-width: thin;
border-bottom-width: medium;
border-bottom-width: thick;
border-bottom-width: inherit;
示例代码
下面的代码将元素的底部边框设置为10像素的红色实线。
.element {
border-bottom-style: solid;
border-bottom-width: 10px;
border-bottom-color: red;
}
在线演示
底部边宽度为30像素蓝色实线
底部边宽度为关键字:thin
底部边宽度为关键字:medium
底部边宽度为关键字:thick
浏览器支持
所有的现代浏览器都支持border-bottom-width属性,包括Chrome,Firefox,Safari,Opera,IE 以及 Android 和 iOS。