border-top

Introduction

The border-top shorthand CSS property sets all the properties of an element's right border.

Examples

Syntax

.border {
  border-top: 1px;
}

It is actually the same as this one:

.border {
  border-top: 1px solid black;
}

Values

This property is a shorthand for the following CSS properties:

As with all shorthand properties, border-top always sets the values of all the properties that it can set, even if they are not specified. It sets those that are not specified to their default values. Consider the following code:

Formal definition

Initial value0
Applies toall elements
Inheritedno
Animatableno

Formal Syntax

<line-width> || <line-style> || <color>
where
<line-width> = <length> | thin | medium | thick
<line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset

Difference from Web

Global values are not supported. (inherit, initial, revert, unset, etc)

Default style value is solid.

Compatibility

LCD tables only load in the browser

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.