docs.rodeo

MDN Web Docs mirror

border-top-color

{{CSSRef}} 

The border-top-color CSS property sets the color of an element’s top border. It can also be set with the shorthand CSS properties {{cssxref("border-color")}}  or {{cssxref("border-top")}} .

{{EmbedInteractiveExample("pages/css/border-top-color.html")}} 

Syntax

/* <color> values */
border-top-color: red;
border-top-color: #ffbb00;
border-top-color: rgb(255 0 0);
border-top-color: hsl(100deg 50% 25% / 75%);
border-top-color: currentcolor;
border-top-color: transparent;

/* Global values */
border-top-color: inherit;
border-top-color: initial;
border-top-color: revert;
border-top-color: revert-layer;
border-top-color: unset;

The border-top-color property is specified as a single value.

Values

Formal definition

{{CSSInfo}} 

Formal syntax

{{csssyntax}} 

Examples

A simple div with a border

HTML

<div class="my-box">
  <p>
    This is a box with a border around it. Note which side of the box is
    <span class="red-text">red</span>.
  </p>
</div>

CSS

.my-box {
  border: solid 0.3em gold;
  border-top-color: red;
  width: auto;
}

.red-text {
  color: red;
}

Result

{{EmbedLiveSample('A_simple_div_with_a_border')}} 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN