HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Set the style of the top border for different elements
The border-top
shorthand property sets all the top border properties in one declaration.
The properties that can be set must be in the following order:
If border-top-color is omitted, the color applied will be the color of the text.
Default value: | medium none color |
---|---|
Inherited: | no |
Animatable: | yes, see individual properties. Read about animatable Try it |
Version: | CSS1 |
JavaScript syntax: | object.style.borderTop="3px dashed blue" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
border-top | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Value | Description | Demo |
---|---|---|
border-top-width | Required. Specifies the width of the top border. Default value is "medium" | Demo ❯ |
border-top-style | Required. Specifies the style of the top border. Default value is "none" | Demo ❯ |
border-top-color | Optional. Specifies the color of the top border. Default value is the color of the text | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS tutorial: CSS Border
HTML DOM reference: borderTop property