CSS borderProperty
Tag definition and usage instructions
border is the shorthand property for the border properties.
The CSS border property is used to specify the style, width, and color of an element's border.
The properties that can be set are (in order): border-width, border-style and border-color.
You can also set only one value, for exampleborder:#FF0000;This is correct; other values will be set to the initial value of the corresponding property.
Syntax format
The border property can be specified using one, two, or three of the values listed below, and the order of the values does not matter:
/* Border style */
border: solid;
/* border-width | border-style */
border: 2px dotted;
/* border-style | border-color */
border: outset #f33;
/* border-width | border-style | border-color */
border: medium dashed green;
/* Global Values */
border: inherit;
border: initial;
border: unset;
border: solid;
/* border-width | border-style */
border: 2px dotted;
/* border-style | border-color */
border: outset #f33;
/* border-width | border-style | border-color */
border: medium dashed green;
/* Global Values */
border: inherit;
border: initial;
border: unset;
Note:If the border style is not defined, it will be invisible. This is because the default style is none.
| Default Value: | not specified |
|---|---|
| Inherited: | no |
| version: | CSS1 |
| JavaScript Syntax: | object object.style.border="3px solid blue" |
Browser Support
The numbers in the table denote the first browser version that supports the property.
| Property | |||||
|---|---|---|---|---|---|
| border | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Property value
| Value | Description |
|---|---|
| border-width | Specify the border width |
| border-style | Specify the border style |
| border-color | Specify the border color |
| inherit | Specifies that the border property value should be inherited from the parent element. |
Related Articles
CSS Tutorial:CSS Borders
other extensions