Please note, this is a STATIC archive of website from 10 Sep 2022, does not collect or store any user information, there is no "phishing" involved.
Expand All | Collapse All

CSS border-width Property

Topic: CSS3 Properties ReferencePrev|Next


The border-width CSS property is a shorthand property for setting the individual border width properties i.e. border-top-width, border-right-width, border-bottom-width, and border-left-width in a single declaration.

The following table summarizes the usages context and the version history of this property.

Default value: medium
Applies to: All elements
Inherited: No
Animatable: Yes. See animatable properties.
Version: CSS 1, 2, 3


The syntax of the property is given with:

[ thin | medium | thick | length ] 1 to 4 values | inherit

This shorthand notation can take one, two, three, or four whitespace separated values.

  • If one value is specified, it applies to all border sides.
  • If two values are specified, the first value is used for the top and bottom border, while the second value is used for the right and left border.
  • If three values are specified, the first value is used for the top border, the second value is used for the right and left border, and the third value is used for the bottom border.
  • If four values are specified, each value applies to the border individually in the order top, right, bottom, and left.

The example below shows the border-width property in action.

p {
    border-style: solid;
    border-width: 5px;

Note: You must declare the border-style property before the border-bottom-width property. An element must have borders before you can set the width of the border, because the default value of the border-style property is none.

Property Values

The following table describes the values of this property.

Value Description
thin A thin border.
medium A medium border.
thick A thick border.
length A length value in px, pt, cm, em, etc. Negative values are not allowed.
inherit If specified, the associated element takes the computed value of its parent element border-width property.

Browser Compatibility

The border-width property is supported in all major modern browsers.

Browsers Icon

Browser Support–

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+)
  • Opera 4+

Further Reading

See tutorial on: CSS Border, CSS3 Border.

Related properties: border, border-style, border-color, border-top-width, border-right-width, border-bottom-width, border-left-width.

Bootstrap UI Design Templates