CSS outline property

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

outline-side: medium;

thin

thin value defines thin outline .

outline-width: thin;

thick

thick value defines a thick outline.

outline-side: thick;

+ve length

lenght defines the width of outline. The used units might be px, in, em, pt.

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.

outline-style: none;

dashed

The outline consists of a series of square shaped dashes.

outline-style: dashed;

dotted

The outline consists of a series of round dots.

outline-style: dotted;

solid

The outline consists of a solid line.

outline-style: solid;

double

The outline consists of two lines. The total ouline-width equals to the two lines and space between them.

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.

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.

outline-style: groove;

inset

The color of top and left borders is darker than outline-color but the color of right and bottom borders is the same as outline-color.

The effect of inset value can be observed in outline.

outline-style: inset;

outset

The color of top and left sides is the same as outline-left but the color of right and bottom sides is darker than outline-color.

The effect of inset value can be observed in outline.

outline-style: outset;

outline-color

currentColorDefault

currentColor keyword represents the same color for the top side border as of text color.

outline: currentColor;

color-name

The following demo represents skyblue color for the top side border.

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.

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.

outline: #0000ff;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
The color of text is green. Therefore the currentColor for the outline is also green.
×

Ctrl+D