Categories
Web development

CSS border-top-color Property

CSS border-top-color Property

The CSS border-top-color property settles the color of an element’s top border.

Syntax:

border-top-color: color|transparent;

color – defines the color of the top border.

transparent – defines that the border color should be transparent.

Example:

<!DOCTYPE html>
<html>
<head>
<style>
h4 {
  border-top-style: solid;
  border-top-color: #2a9d8f;
}

p {
  border-style: solid;
  border-top-color: #e76f51;
}
</style>
</head>
<body>

<h4>A heading with a colored top border.</h4>
<p>A paragraph with a colored top border.</p>

</body>
</html>

Output:

A heading with a colored top border.

A paragraph with a colored top border.


Enjoy coding!

Read also:

CSS border-bottom-color Property

CSS Gradient Border