CSS outline property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS outline property defines the width, style, and color of the ouline of a box. It is a shorthand property of outline-width, outline-style, and outline-color.
Syntax
outline : outline-width outline-style outline-color
Property values
outline-width
mediumDefault
-
medium value represents medium sized outline. thin<medium<thick
- Try it
outline-side: medium; +ve length
-
lenght defines the width of outline. The used units might be px, in, em, pt.
- Try it
outline-width: 10px;
outline-style
noneDefault
-
There is no style. In this case, the color and width of outline are also ignored i.e. 0px outline.
- Try it
outline-style: none; double
-
The outline consists of two lines. The total ouline-width equals to the two lines and space between them.
- Try it
outline-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 outline-color.
The outer side of the outline is darker than the inner side of the outline.
- Try it
outline-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 outline is darker than the outer side of the outline.
- Try it
outline-style: groove;
outline-color
currentColorDefault
-
currentColor keyword represents the same color for the top side border as of text color.
- Try it
outline: currentColor; color-name
-
The following demo represents skyblue color for the top side border.
- Try it
outline: skyblue; rgb value
-
It represents rgb value of a color.
The hexadecimal value of red color for the top side border is given below.
- Try it
outline: rgb(255,0,0); hexadecimal value
-
It represents hexadecimal notation of red color.
The hexadecimal notation of blue color for the top side border is given below.
- Try it
outline: #0000ff;
Applicable to
It applies to all elements