Syntax: border: border-width border-style border-color
Example: p {border: 2px double red;}
Table of Contents
How to Apply Border for Individual Sides
Syntax:
border-top: border-width border-style border-color
border-bottom: border-width border-style border-color
border-left: border-width border-style border-color
border-right: border-width border-style border-color
Example:
#topborder {border-top: thin dashed blue;}
#bottomborder {border-bottom:thick dotted brown;}
#leftborder {border-left: medium groove pink;}
#rightborder {border-right: 2px double red;}
Demo:
How to Set Border Width for Each Sides
Syntax:
border-top-width: non-negative length | thick| medium | thin | inherit
border-bottom-width: non-negative length | thick| medium | thin | inherit
border-left-width: non-negative length | thick| medium | thin | inherit
border-right-width: non-negative length | thick| medium | thin | inherit
Example:
#topwidth { border-top-width: 2px;border-top-style:solid;}
#bottomwidth {border-bottom-width: thick;border-bottom-style:solid;}
#leftwidth {border-left-width: medium;border-left-style:solid;}
#rightwidth {border-right-width: thin;border-right-style:solid;}
Demo:
How to Set Border Style for Each Sides
Syntax:
border-top-style: dashed | dotted | double | groove | inherit | hidden | inset | none | outset | ridge | solid
border-bottom-style: dashed | dotted | double | groove | inherit | hidden | inset | none | outset | ridge | solid
border-left-style: dashed | dotted | double | groove | inherit | hidden | inset | none | outset | ridge | solid
border-right-style: dashed | dotted | double | groove | inherit | hidden | inset | none | outset | ridge | solid
Example:
#topstyle { border-width: thick; border-top-style:solid;}
#bottomstyle { border-width:thick; border-bottom-style:dashed;}
#leftstyle { border-width:thick; border-left-style:double;}
#rightstyle {border-width:thick; border-right-style:groove;}
Demo:
How to Apply Border Color for Each Sides
Syntax:
border-top-color: color | transparent | inherit
border-bottom-color: color | transparent | inherit
border-left-color: color | transparent | inherit
border-right-color: color | transparent | inherit
Example:
#topcolor {border-width: thick; border-style:solid; border-top-color: red;}
#bottomcolor {border-width: thick; border-style:solid;border-bottom-color: blue;}
#leftcolor {border-width: thick; border-style:solid;border-left-color:brown;}
#rightcolor {border-width: thick; border-style:solid;border-right-color:green;}
Demo:
How Collapse or Separate Border Spacing
Syntax: border-collapse: collapse | separate | inherit
Example: #collapse {border-collapse: collapse;}
#separate {border-collapse: separate;}
Demo:
Read Next:How to Customize List Style Using CSS
Comments are closed.