CSS border property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS border property defines width, style and color of the border for all the sides of a box.
Syntax
border : border-width border-style border-color;
Property values
border-width
mediumDefault
-
medium value represents medium sized border. thin≤medium≤thick
- Try it
border-width: medium; +ve length
-
lenght defines the line width of border. The used units might be px, in, em, pt.
- Try it
border-width: 10px;
border-style
noneDefault
-
There is no style. In this case, the color and width of border are also ignored i.e. 0px border.
- Try it
border-style: none; hidden
-
It is same as 'none' but resolve to different results for the border-collapse property in tables.
- Try it
border-style: hidden; double
-
The border consists of two lines. The total border-width equals to the two lines and space between them.
- Try it
border-style: double; ridge
-
The content seems to be coming out of the canvas. It is obtained by producing the box-shadow from the two colors that are lighter and darker than the border-color.
The outer side of the border is darker than the inner side of the border.
- Try it
border-style: ridge; groove
-
The content seems to be going into the canvas. It is obtained by producing the box-shadow from the two colors that are lighter and darker than the border-color.
The inner side of the border is darker than the outer side of the border.
- Try it
border-style: groove;
border-color
currentColorDefault
-
currentColor keyword represents the same color for the border as of text color.
- Try it
border-color: currentColor; rgb value
-
It represents rgb value of a color.
The hexadecimal value of red color for the border is given below.
- Try it
border-color: rgb(255,0,0); hexadecimal value
-
It represents hexadecimal notation of red color.
The hexadecimal notation of blue color for the border is given below.
- Try it
border-color: #0000ff;
Applicable to
See longhand properties