CSS border-top-color Property Tutorial

In this section, we will learn what the border-top-color property is and how to use it in CSS.

Click here to run the example of border-top-color property.

CSS border-top-color Property Definition and Usage

The border-top-color property is used to set a color value for the top border of an element.

Note: before using this property, the border should already exist. We can create a border via the border-style, border-bottom-style, or border property.

CSS border-top-color Property Syntax

border-top-color: color|transparent|initial|inherit;

CSS border-top-color Property Value

We can use color formats like RGB, RGBA, HSL, HSLA, color-name as the value of this property.

Also, we could use the value “transparent” to set a transparent color for the target bottom border.

Example: border-top-color property in CSS

See the Pen border-top-color property in CSS by Enjoy Tutorials (@enjoytutorials) on CodePen.

How Does CSS border-top-color Property Work?

Here, we’ve used the border-top-color property to change the color of the top border from black to red. (The default color is the color of the element’s font)


Top Technologies