CSS border-width Property

Description

The border-width property specifies the border width of an element. Used as a shortcut to determine the entire border width in one rule.

Initial value
See individual properties
Applies to
All elements
Inherited
No
Media
Visual
Computed value
See individual properties
Animatable
Yes
CSS Version
CSS1, CSS2, CSS3
JavaScript syntax
object.style.borderWidth

Syntax

Formal syntax: <line-width>{1,4} 

border-width: 2px;
border-width: 2px 1px;
border-width: 2px 4px 3px;
border-width: 2px 1px 3px 4px;

Values

<line-width> = <length> | thin | medium | thick
  • thinLess than the default width.
  • mediumDefault value.
  • thickGreater than the default width.
  • <length>Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).
  • inherit

Example

.class {
   border-width: medium;
}

Give it a Try

Click the button below to experiment with this property.

Give it a Try!

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
412113.51
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
218410.13?