Border Width

Category:CSS Properties

Border Width

The border- width property specifies the width of all four sides of an element's border. It is a shorthand for top, right, bottom, and left border width respectively. When one value is specified, it applies the same width to all four sides.The width can be set as a specific size (in px, pt, cm, em, etc) or by using one of the three predefined values: thin, medium, or thick.

Examples

Width Using a Predefined Value

Setting the width of the four sides of a<h1> element border to thick.

h1 {
  border-style: solid;
  border-width: thick;
}

Different Border Widths

Setting the width of the four sides of a <h1> element border to four values (top border, right border, bottom border, and the left border respectively).

h1 {
  border-style: solid;
  border-width: 25px 10px 4px 35px;
}

Syntax

border-width: value;

Tips

  • The default border width is medium.
  • The border width property can take one to four values at a time.
  • Always set the border-style property before the border-width property.

Additional Information

For more information, see http://www.w3schools.com/cssref/pr_border-width.asp

Found a bug in the documentation? Let us know at documentation@code.org