CSS border-top property
Example
Set the style of the top border:
p
{
border-style:solid;
border-top:thick double #ff0000;
}
Try it »
Property definition and usage
The border-top shorthand property sets all top border properties in a single declaration
The properties that can be set are (in order): border-top-width, border-top-style, and border-top-color.
It is fine if one of the values is not set, for example border-top: solid #ff0000; is also allowed.
| Default value: | not specified |
|---|---|
| Inheritance: | no |
| Version: | CSS1 |
| JavaScript syntax: | object.style.borderTop="3px solid blue" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| border-top | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Attribute values
| Value | Description |
|---|---|
| border-top-width | Specifies the width of the top border. See:border-top-width Possible values. |
| border-top-style | Specifies the style of the top border. See:border-top-style Possible values. |
| border-top-color | Specifies the color of the top border. See:border-top-color Possible values. |
| inherit | Specifies that the settings of the border-top property should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Border