CSS border-style property
Example
Set the styles of the four borders:
p
{
border-style:
solid
;
}
Try it »
More examples can be found at the bottom of this page.
Property definition and usage
The border-style property sets the styles of all four borders of an element. This property can have one to four values.
Example:
**border-style:dotted solid double dashed; **
- The top border is dotted
- The right border is solid
- The bottom border is double
- The left border is dashed
border-style:dotted solid double;
- The top border is dotted
- The right and left borders are solid
- The bottom border is double
border-style:dotted solid;
- The top and bottom borders are dotted
- The right and left borders are solid
border-style:dotted;
- All four borders are dotted
| Default value: | not specified |
|---|---|
| Inherited: | no |
| Version: | CSS1 |
| JavaScript syntax: | object object.style.borderStyle="dotted double" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| border-style | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Attribute values
| Value | Description |
|---|---|
| none | Defines no border. |
| hidden | Same as "none". Except when applied to tables, where hidden is used to resolve border conflicts. |
| dotted | Defines a dotted border. Rendered as a solid line in most browsers. |
| dashed | Defines a dashed border. Rendered as a solid line in most browsers. |
| solid | Defines a solid line. |
| double | Defines a double line. The width of the double line equals the value of border-width. |
| groove | Defines a 3D grooved border. Its effect depends on the value of border-color. |
| ridge | Defines a 3D ridged border. Its effect depends on the value of border-color. |
| inset | Defines a 3D inset border. Its effect depends on the value of border-color. |
| outset | Defines a 3D outset border. Its effect depends on the value of border-color. |
| inherit | Specifies that the border style should be inherited from the parent element. |
Online example
Set a different border on each side
This example demonstrates how to set different borders on each side of an element.
Related Articles
CSS Tutorial: CSS Border