border-top property CSS Reference



Definition and Usage

The border-top CSS property is a shorthand that sets the values of border-top-color, border-top-style, and border-top-width. These properties describe the top border of elements.

  • Initial the concatenation of the initial values of its longhand properties:
    • border-top-width: medium
    • border-top-style: none
    • border-top-color: currentColor
  • Applies to all elements
  • Inherited no
  • Media visual
  • Computed Value as each of the properties of the shorthand:
    • border-top-width: the absolute length or 0 if border-top-style is none or hidden
    • border-top-style: as specified
    • border-top-color: If the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The transparent keyword maps to rgb(0,0,0).
  • Animatable as each of the properties of the shorthand:
    • border-top-color: yes, as a color
    • border-top-style: no
    • border-top-width: yes, as a length
  • Canonical order order of appearance in the formal grammar of the values

Syntax

Formal syntax: <br-width> || <br-style> || <color>

Values

<br-width> 
See border-top-width.
<br-style> 
See border-top-style.
<color> 
See border-top-color.

Examples

element {
    border-top: 1px solid #000;
}

Compatibility

Desktop browsers

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.01.0 (1.7 or earlier)43.51.0 (85)

Mobile browsers

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support1.01.0 (1.0)(Yes)(Yes)(Yes)

Relative articles