CSS border-top-color

The border-top-color property sets the color of the top border of an element. It can be used to specify a different color for each side of the border, or set the same color for all borders by using the border-color property.

Here is an example of how to use the border-top-color property:

Result:
This is an example text with a blue top border.

In the example above, we have set the border-top-color property to blue to apply a blue color to the top border of the <div> element.

It is important to note that the value of the border-top-color property can be specified using color names, hexadecimal, RGB, RGBA, HSL, or HSLA values.

Here is an example using hexadecimal value for the border color:

Result:
This is an example text with a red top border.

In this second example, we have set the border-top-color property to #FF0000 which is the hexadecimal representation of the color red.

Remember that you can also use the border-color property to set the same color for all borders of an element. Here is an example:

Result:
This is an example text with a green border on all sides.

In this example, we have set the border-color property to green to apply a green color to all sides of the border of the <div> element.