CSS border-top Property


Example

Set the style of the top border:

p {
    border-style: solid;
    border-top: thick double #ff0000;
}

Try it yourself »

Definition and Usage

The border-top shorthand property sets all the top border properties in one declaration.

The properties that can be set, are (in order): border-top-width, border-top-style, and border-top-color.

If one of the values above are missing, e.g. border-top:solid #ff0000, the default value for the missing property will be inserted, if any.

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


Browser Support

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

Note: See individual browser support for each value below.


CSS Syntax

border-top: border-width border-style border-color|initial|inherit;

Property Values

Value Description
border-top-width Specifies the width of the top border. Default value is "medium"
border-top-style Specifies the style of the top border. Default value is "none"
border-top-color Specifies the color of the top border. Default value is the color of the element
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit


Related Pages

CSS tutorial: CSS Border

HTML DOM reference: borderTop property



Color Picker

colorpicker