border-top-width
css属性
border-top-width
是用于设置盒模型的上边框的宽度。
示例
/* keyword values */
border-top-width: thin;
border-top-width: medium;
border-top-width: thick;
/* <length> values */
border-top-width: 10em;
border-top-width: 3vmax;
border-top-width: 6px;
/* global keywords */
border-top-width: inherit;
border-top-width: initial;
border-top-width: unset;
浏览器支持
语法
border-top-width
:
<length>
|
thin
|
medium
|
thick
取值:
-
<length>
:用长度值来定义边框的厚度。不允许负值。
-
thin
:定义比默认厚度细的边框。计算值为1px。
-
medium
:定义默认厚度的边框。计算值为3px。
-
thick
:定义比默认厚度粗的边框。计算值为5px。
默认值
|
medium
|
适用于
|
所有元素
|
继承性
|
无
|
动画性
|
否
|
计算值
|
指定值
|
实例
//HTML
<div>element 1</div>
<div>element 2</div>
//CSS
div {
border: 1px solid red;
margin: 1em 0;
}
div:nth-child(1) {
border-top-width: thick;
}
div:nth-child(2) {
border-top-width: 2em;
}