loading

Border Width

CSS Border Width

The width of each of the four borders is specified by the border-width attribute.

The width can be set using one of the three pre-defined values—thin, medium, or thick—or as a specified dimension (in pixels, points, centimeters, em, etc.):

Example

Demonstration of the different border widths:

				
					p.one {
  border-style: solid;
  border-width: 5px;
}

p.two {
  border-style: solid;
  border-width: medium;
}

p.three {
  border-style: dotted;
  border-width: 2px;
}

p.four {
  border-style: dotted;
  border-width: thick;
}
				
			

Result:

5px border-width
medium border-width
2px border-width
thick border-width

Specific Side Widths

For the top border, right border, bottom border, and left border, the border-width attribute can have one to four values:

Example

				
					p.one {
  border-style: solid;
  border-width: 5px 20px; /* 5px top and bottom, 20px on the sides */
}

p.two {
  border-style: solid;
  border-width: 20px 5px; /* 20px top and bottom, 5px on the sides */
}

p.three {
  border-style: solid;
  border-width: 25px 10px 4px 35px; /* 25px top, 10px right, 4px bottom and 35px left */
}
				
			
Share this Doc

Border Width

Or copy link

Explore Topic