CSS outline


An outline is a line drawn around an element, located outside the border edge, which can serve to highlight the element.

The outline property specifies the style, color, and width of an element's outline.


Outline example

Draw lines around elements
This example demonstrates drawing a line around an element using the outline property.

Set the outline style
This example demonstrates how to set the style of an outline.

Set the outline color
This example demonstrates how to set the color of an outline.

Set the outline width
This example demonstrates how to set the width of an outline.


CSS Outline

An outline is a line drawn around an element, located outside the border edge, which can serve to highlight the element.

The CSS outline property specifies the style, color, and width of an element's outline.

Outline

All CSS outline properties

The numbers in the "CSS" column indicate which CSS version defined the property (CSS1 or CSS2).

Property Description Value CSS
outline Set all outline properties in one declaration. outline-color
outline-style
outline-width
inherit
2
outline-color Set the outline color color-name
hex-number
rgb-number
invert
inherit
2
outline-style Set the outline style none
dotted
dashed
solid
double
groove
ridge
inset
outset
inherit
2
outline-width Set the outline width thin
medium
thick
length
inherit
2
other extensions