HTML Dog
Skip to navigation

CSS Property: border-top

The width, style, and color of the top border of a box.

A shorthand property that combines border-top-width, border-top-style, and border-top-color.

Possible Values

A space-separated list, containing up to three values representing border-top-width, border-top-style, and border-top-color. Any excluded values will default to their initial value.

Value Description Example
[width]
(equivalent of border-top-width value)
  • Width is set explicitly.
  • Style defaults to none.
  • Color defaults to the computed color property of the box.
2px
[style]
(equivalent of border-top-style value)
  • Style is set explicitly.
  • Width defaults to medium.
  • Color defaults to the computed color property of the box.
solid
[color]
(equivalent of border-top-color value)
  • Color is set explicitly.
  • Width defaults to medium.
  • Style defaults to none.
red
[width] [style]
  • Width is set explicitly.
  • Style is set explicitly.
  • Color defaults to the computed color property of the box.
2px solid
[width] [color]
  • Width is set explicitly.
  • Color is set explicitly.
  • Style defaults to none.
2px red
[style] [color]
  • Style is set explicitly.
  • Color is set explicitly.
  • Width defaults to medium.
solid red
[width] [style] [color]
  • Width is set explicitly.
  • Style is set explicitly.
  • Color is set explicitly.
2px solid red
inherit
initial
unset

Example


#reptile { border-top: 1px solid #ff8800; }