CSS border-width attribute

Examples

Set the width of the four borders:

p
{
border-style: solid;
border-width: 15px;
}


Attribute definitions and instructions

border-width property is set to a width of four border element. This property can have one to four values.

Example:

border-width: thin medium thick 10px ;

  • The border is a thin border
  • The right of the box is a medium frame
  • Bottom border is rough border
  • Left border are 10px wide border

border-width: thin medium thick;

  • The border is a thin border
  • Right border and left border is a medium frame
  • Bottom border is rough border

border-width: thin medium;

  • Upper and bottom borders are thin border
  • Right border and left border is a medium frame

border-width: thin;

  • All four borders are thin border
Defaults: medium
Inherited: no
version: CSS1
JavaScript syntax: object .style.borderWidth = "thin thick"


Browser Support

Figures in the table represent the first browser to support the version number of the property.

属性
border-width 1.0 4.0 1.0 1.0 3.5

Property Value

value description
thin Fine defined borders.
medium default. Defines the medium border.
thick Defined thick border.
length It allows you to customize the width of the border.
inherit Provisions should inherit the border width from the parent element.


related articles

CSS tutorial: CSS Border