Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The border-top shorthand CSS property sets all the properties of an element's top border.
This property is a shorthand for the following CSS properties:
The three values of the shorthand property can be specified in any order, and one or two of them may be omitted.
See border-top-width.
<br-style>See border-top-style.
<color>See border-top-color.
As with all shorthand properties, border-top always sets the values of all of 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:
It is actually the same as this one:
The value of border-top-style given before border-top is ignored. Since the default value of border-top-style is none, not specifying the border-style part results in no border.
as each of the properties of the shorthand:
|
| all elements. It also applies to ::first-letter. |
| no |
as each of the properties of the shorthand:
|
as each of the properties of the shorthand:
|
| CSS Backgrounds and Borders Module Level 3 # border-shorthands |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 20, 2026 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.