CSS border-top
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The border-top
CSS property sets the width, style, and color of the top border of an element. It is a shorthand property for setting the individual top border properties i.e. border-top-width
, border-top-style
, and border-top-color
in a single declaration.
The following table summarizes the usages context and the version history of this property.
Default value: | See individual properties |
---|---|
Applies to: | All elements |
Inherited: | No |
Animatable: | Yes, See individual properties. See animatable properties. |
Version: | CSS 1, 2, 3 |
Syntax
The syntax of the property is given with:
The example below shows the border-top
property in action.
Example
Try this code »h1 {
border-top: 5px solid #ff0000;
}
p {
border-top: 3px dotted #00ff00;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
border-top-width |
Sets the width of the top border of an element. |
border-top-style |
Sets the line style of the top border of an element. |
border-top-color |
Sets the color of the top border of an element. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element border-top property. |
Browser Compatibility
The border-top
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS Border, CSS3 Border.
Related properties: border
, border-top-color
, border-top-style
, border-top-width
.