📅  最后修改于: 2020-11-04 03:55:57             🧑  作者: Mango
CSS边框是用于在元素上设置边框的简写属性。
CSS边框属性用于指定元素边框的样式,颜色和大小。 CSS边框属性如下
边框样式属性用于指定要在网页上显示的边框类型。
有一些边框样式值与border-style属性一起使用以定义边框。
Value | Description |
---|---|
none | It doesn’t define any border. |
dotted | It is used to define a dotted border. |
dashed | It is used to define a dashed border. |
solid | It is used to define a solid border. |
double | It defines two borders wIth the same border-width value. |
groove | It defines a 3d grooved border. effect is generated according to border-color value. |
ridge | It defines a 3d ridged border. effect is generated according to border-color value. |
inset | It defines a 3d inset border. effect is generated according to border-color value. |
outset | It defines a 3d outset border. effect is generated according to border-color value. |
No border.
A dotted border.
A dashed border.
A solid border.
A double border.
A groove border.
A ridge border.
An inset border.
An outset border.
A hidden border.
输出:
No border.
A dotted border.
A dashed border.
A solid border.
A double border.
A groove border.
A ridge border.
An inset border.
An outset border.
border-width属性用于设置边框的宽度。以像素为单位设置。您也可以使用三个预定义值之一(细,中或粗)来设置边框的宽度。
注意:border-width属性不能单独使用。它总是与其他边框属性(例如“ border-style”属性)一起使用,以首先设置边框,否则将无法使用。
Write your text here.
Write your text here.
Write your text here.
有三种方法可以设置边框的颜色。
还有一个名为“透明”的边框颜色。如果未设置边框颜色,则从元素的color属性继承。
注意:border-color属性不能单独使用。它总是与其他边框属性(例如“ border-style”属性)一起使用,以首先设置边框,否则将无法使用。
This is a solid red border
This is a solid green border