Style borderTopColor Property

Definition and Usage

borderTopColor Sets or returns the color of the element's top border.

See also:

CSS Tutorial:CSS kantlinje

CSS Reference Manual:border-top-color property

HTML DOM Reference Manual:border property

Example

Example 1

Changes the top border color of the <div> element to red:

document.getElementById("myDiv").style.borderTopColor = "red";

Try it yourself

Example 2

Returns the top border color of the <div> element:

alert(document.getElementById("myDiv").style.borderTopColor);

Try it yourself

Syntax

Return borderTopColor property:

object.style.borderTopColor

Set borderTopColor property:

object.style.borderTopColor = "color|transparent|initial|inherit"

Property value

Value Description
color

Specifies the color of the top border. The default color is black.

Please see CSS color values, for a complete list of possible color values.

transparent The top border color is transparent (the underlying content will show through).
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: black
Return value: A string representing the color of the element's top border.
CSS version: CSS1

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Støtte Støtte Støtte Støtte Støtte