Dofactory.com
Dofactory.com
Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

CSS border-top-color

The border-top-color property sets the color of the top border.

Color values can be hex, rgb, hsl, rgba, hsla, or a color name.

A border-top-style value is required for a border to show.

Example

#

An element with a colored top border.

indigo colored top border
<style>
  .border-top-color {
    padding: 5px;
    border-top-style: solid;
    border-top-color: #302ea3;
  }
</style>

<div class="border-top-color">
  indigo colored top border
</div>

Syntax

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

Values

#

Value Description
color top border color. Accepts colorname, hex, rgb, rgba, hsl, hsla values.
transparent Sets top border color to transparent
initial Sets the value to its default value.
inherit Inherits the value from its parent element.

More Examples

Click the buttons to see the different border-top-color values.

border-top-color: #302ea3
<style>
  .border-top-example {
    padding: 10px;
    border-top-style: solid;
    border-top-color: #302ea3;
  }
</style>

<div class="border-top-example">
  border-top-color: #302ea3
</div>

Browser support

This table shows when border-top-color support started for each browser.

Chrome
1.0 Dec 2008
Firefox
1.0 Nov 2004
IE/Edge
4.0 Sep 1997
Opera
3.5 Nov 1998
Safari
1.0 Jun 2003

You may also like


Last updated on Sep 30, 2023

Earn income with your CSS skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides