Syntax |
selector {border: width style color;}
- width is specified by using a length or one of the following keywords: thin, medium, or thick.
- style is specified by using one of the following keywords: none, hidden, dotted, dashed, solid, double, groove, ridge, inset, or outset.
- color is specified by using a color-value or one of the following keywords: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, yellow, or transparent.
- width, style, and color are all OPTIONAL but at least one of them must occur.
(OR)
selector {border: value;}
- value is specified by using the keyword inherit.
|
Usage |
The border property is used as a shorthand method to specify one or more of the 3 border values (width, style, and color) all in one place. This property applies to all 4 sides.
All 3 of these values are optional but at least one of them must be specified. Any of these values that are not specified will automatically be set to their initial value. Since the initial value for style is none, the border will not be visible unless style is set to one of the visible styles.
CSS Example: The border property is set by specifying all 3 values. h1 {border: thin solid #ffa500;}    CSS Example: The border property is set by only specifying a style. h1 {border: dotted;}    |
Keywords |
|
Applies To |
All elements |
Inherited |
No |
Initial Value |
- medium for the border width
- none for the border style
- The same as the value of the color property for the border color
|