border-width Redirect 1


The border-width CSS property sets the width of the border of a box. Using the shorthand property border is often more convenient.

  • Initial value the concatenation of the initial values of its longhand properties:
    • border-top-width: medium
    • border-right-width: medium
    • border-bottom-width: medium
    • border-left-width: medium
  • Applies to all elements
  • Inherited no
  • Media visual
  • Computed value as each of the properties of the shorthand:
  • Animatable as each of the properties of the shorthand:
    • border-bottom-width: yes, as a length
    • border-left-width: yes, as a length
    • border-right-width: yes, as a length
    • border-top-width: yes, as a length
  • Canonical order the unique non-ambiguous order defined by the formal grammar


Formal syntax: <br-width>{1,4}
border-width: width                  /* One-value syntax */
border-width: horizontal vertical    /* Two-value syntax */
border-width: top vertical bottom    /* Three-value syntax */
border-width: top right bottom left  /* Four-value syntax */

border-width: inherit


Is either a non-negative explicit <length> value or a keyword denoting the thickness of the bottom border. The keyword must be one of the following values:
A thin border
A medium border
A thick border
The specification doesn't precisely define the thickness of each of the keywords, which is therefore implementation specific. Nevertheless, it requests that the thickness does follow the thin ≤ medium ≤ thick inequality and that the values are constant on a single document.


Is a keyword indicating that all four values are inherited from their parent's element calculated value.


border: ridge #ccc;
border-width: 6px;  /* same as "border: ridge #ccc 6px";  6px wide border on all 4 sides */
border: solid red;
border-width: 2px 10px;  /* 2px wide top and bottom border, 10px right and left border */
border: dotted orange;
border-width: 0.3em 0;   /* 0.3em wide top and bottom border, no border right and left */
border: solid lightgreen;
border-width: medium 0 1px thick;  /* three different width, no right border */


Specification Status Comment
CSS Backgrounds and Borders Module Level 3 Candidate Recommendation No direct change, the <length> CSS data type extension has an effect on this property.
CSS Level 2 (Revision 1) Recommendation Added the constraint that values' meaning must be constant inside a document.
CSS Level 1 Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier) 4.0 3.5 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 1.0 (1.9.2) ? ? ?

See also

Document Tags and Contributors

 Last updated by: Sheppy,