The border-top property

The border-top property specifies a color, type, and width for a top border. It is a shorthand property for border-top-width, border-top-style and border-top-color.

Syntax

cssselector {
  border-top: width type color;
}

The order of the properties does not matter.

Example

Let's give the element a black top border with 2px width:

html<div id="elem"></div>
css#elem {
  border-top: 2px solid black;
  background: #f9f9f9;
  width: 300px;
  height: 100px;
}

Результат: