CSS border Property


Set the style of the borders for different elements:

h1 {
border: 5px solid red;

h2 {
border: 4px dotted blue;

div {
border: double;

Try it Yourself »

Definition and Usage

The border property is a shorthand property for border-width, border-style and border-color.

Default value: medium none color
Inherited: no
Animatable: yes, see individual propertiesRead about animatable – Try it
Version: CSS1
JavaScript syntax: object.style.border=”3px solid blue” Try it
CSS Syntax
border: border-width border-style border-color|initial|inherit;
Property Values
Value Description
border-width Specifies the width of the border. Default value is “medium”
border-style Specifies the style of the border. Default value is “none”
border-color Specifies the color of the border. Default value is the color of the text
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit