Border Property will set the border of an HTML element with it’s own width, style, color and radius.
these are various styles of the border, Following are the allowed values for border-style: property:
dotted
– Defines a dotted borderdashed
– Defines a dashed bordersolid
– Defines a solid borderdouble
– Defines a double bordergroove
– Defines a 3D grooved border. The effect depends on the border-color valueridge
– Defines a 3D ridged border. The effect depends on the border-color valueinset
– Defines a 3D inset border. The effect depends on the border-color valueoutset
– Defines a 3D outset border. The effect depends on the border-color valuenone
– Defines no borderhidden
– Defines a hidden border
You can also write shorthand way of writing all properties in one go, syntax as follows:
Syntax: border: border-width, border-style, border-color;
Ex: border:5px dotted red;
HTML:
<div class=”box1″></div>
<div class=”box2″></div>
<div class=”box3″></div>
CSS:
.box1{
width:500px;
height:100px;
border:5px dotted red;
border-radius: 5px;
}
.box2{
width:500px;
height:100px;
border-width:5px;
border-style:solid;
border-color:green;
border-radius: 5px;
}
.box3{
width:500px;
height:100px;
border-width:5px;
border-style:double;
border-color:cyan;
border-radius: 5px;
}
Code Pen Ref: Code Pen Source code of above example