HTML CSS examples for CSS Property:border-width
The border-width CSS property is a shorthand property for setting the individual border.
The following table summarizes the border-width Property.
Item | Value |
---|---|
Default value: | medium |
Applies to: | All elements |
Inherited: | No |
Animatable: | Yes. |
The syntax of the property is as follows:
border-width [ thin | medium | thick | length ] 1 to 4 values | inherit
This shorthand notation can take one, two, three, or four whitespace separated values.
The following table describes the values of this property.
Value | Description |
---|---|
thin | A thin border. |
medium | A medium border. |
thick | A thick border. |
length | A length value in px, pt, cm, em, etc. Negative values are not allowed. |
inherit | take the value of its parent element border-width property. |
The example below shows the border-width property.
<!DOCTYPE html> <html lang="en"> <head> <title>Example of CSS border-width property</title> <style type="text/css"> p.one {<!--from w w w .j a va 2s .co m--> border-style: solid; border-width: 5px; } p.two { border-style: solid; border-width: 5px 10px; } p.three { border-style: solid; border-width: 5px 10px 15px; } p.four { border-style: solid; border-width: medium 10px thick 15px; } </style> </head> <body> <p class="one"><strong>one-value syntax:</strong>.</p> <p class="two"><strong>two-value syntax:</strong>.</p> <p class="three"><strong>three-value syntax:</strong>.</p> <p class="four"><strong>four-value syntax:</strong>.</p> </body> </html>