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 shorthand CSS property sets an element's border. It sets the values of border-width, border-style, and border-color.
This property is a shorthand for the following CSS properties:
The border property may be specified using one, two, or three of the values listed below. The order of the values does not matter.
Note: The border will be invisible if its style is not defined. This is because the style defaults to none.
Sets the thickness of the border. Defaults to medium if absent. See border-width.
<line-style>Sets the style of the border. Defaults to none if absent. See border-style.
<color>Sets the color of the border. Defaults to currentColor if absent. See border-color.
As with all shorthand properties, any omitted sub-values will be set to their initial value. Importantly, border cannot be used to specify a custom value for border-image, but instead sets it to its initial value, i.e., none.
The border shorthand is especially useful when you want all four borders to be the same. To make them different from each other, however, you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side. Alternatively, you can target one border at a time with the physical (e.g., border-top ) and logical (e.g., border-block-start) border properties.
Borders and outlines are very similar. However, outlines differ from borders in the following ways:
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 # propdef-border |
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.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.