CSS Reference ยท Borders, Outlines and Shadows
The outline-style property
Reference for the CSS outline-style property: none, auto, solid, dashed, dotted, double, groove, ridge, inset and outset, with a live comparison of every style.
The outline-style property chooses how an element's outline is drawn: as a solid line, dashes, dots, and so on. Its initial value is none, which is why an outline never shows up until you set a style, even if you have set a width and a color.
It takes the same keywords as border-style, with two differences: auto is allowed, and hidden is not.
.highlight { outline-style: dashed; outline-width: 2px; }
Try it
Syntax
outline-style: auto | <outline-line-style>; /* <outline-line-style> = none | dotted | dashed | solid | double | groove | ridge | inset | outset */
- Initial value:
none - Applies to: all elements
- Inherited: no
- Animatable: no (switches discretely)
- Computed value: as specified
Values
| Value | Description |
|---|---|
none |
No outline is drawn, and the width is treated as 0. |
auto |
A browser-defined style, normally the same as its default focus ring. May ignore width and color. |
solid |
One continuous line. |
dashed |
A series of short dashes. |
dotted |
A series of dots. |
double |
Two parallel lines with a gap; the width must be at least 3px for the gap to appear. |
groove, ridge |
3D effects that look carved in or raised. They use shades of the color. |
inset, outset |
3D effects that make the box look sunken or raised. |
Usage notes
- Set a style or nothing shows. The shorthand
outline: 2px blueis a common mistake; addsolid. autois special. Browsers often draw a two-tone ring that stays visible on any background, and may follow rounded corners. This is hard to match with custom colors, which is why many sites keepautofor focus.- The 3D styles look different per browser and are rarely used on modern sites.
solidanddashedare the practical choices. - Transitions do not interpolate between styles; the change is instant, though width and color can be animated.
Browser support
Supported in every browser. The exact look of auto, groove, ridge, inset and outset differs between browsers.