CSS Reference ยท Borders, Outlines and Shadows
The outline-width property
Reference for the CSS outline-width property: thin, medium, thick and length values, why it needs an outline-style, and how it affects focus rings.
The outline-width property sets how thick an element's outline is. Like all outline properties it has no effect on layout: a thicker outline simply grows outward and overlaps its surroundings.
The width only matters when the outline-style is not none. If the style is none, the computed width is 0.
CSS
input:focus-visible { outline: solid; outline-width: 3px; }
Try it
Syntax
CSS
outline-width: <line-width>; /* <line-width> = <length [0,โ]> | thin | medium | thick */
- Initial value:
medium - Applies to: all elements
- Inherited: no
- Animatable: yes, as a length
- Computed value: an absolute length, or
0if the outline style isnone
Values
| Value | Description |
|---|---|
<length> |
A non-negative length such as 2px or 0.2em. Percentages are not allowed. |
thin |
A thin line. The exact size is browser-defined but is usually about 1px. |
medium |
The default; usually about 3px. |
thick |
A thick line; usually about 5px. |
Usage notes
- Prefer lengths. The keywords vary slightly between browsers, so use
2pxor3pxwhen you need a predictable result. - Outline widths are never clipped by siblings, but an ancestor with
overflow: hiddenwill cut the outline off. Add space with padding or use a negativeoutline-offsetto draw it inside. - Accessibility. A focus indicator at least 2px thick is generally easier to see than a hairline.
- Computed width rounding. Browsers snap widths to whole device pixels, so
0.5pxmay render as a full pixel or not at all.
Browser support
Supported in every browser.