CSS Portal

CSS outline-width Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The outline-width property controls the thickness of the outline drawn around an element. It determines how prominent that outline will appear relative to the element it surrounds, so designers use it to make focus indicators, highlights, or debugging outlines more or less noticeable. Because the outline is visually separate from the element’s border, adjusting outline-width changes only the visual weight of the line and not the element’s layout or intrinsic size.

Outline appearance usually works together with other outline-related properties: its pattern comes from outline-style and its color comes from outline-color. You can think of outline-width as the weight component of that trio: style defines shape, color defines hue, and width defines thickness. In practice, authors often tune all three together to achieve a readable focus ring or a subtle debugging rim.

It’s important to understand how outlines differ from similar visual effects such as border and box-shadow. Unlike a border, an outline does not take part in the box model and therefore does not change layout, margins, or element size; unlike many shadows, outlines are a distinct stroke drawn outside the element edge and can be separated from the element by outline-offset. Because of this separation, large outline widths can overlap neighboring content visually without causing reflow.

From a design and accessibility perspective, increasing outline-width is a simple way to improve the visibility of focus indicators for keyboard and assistive technology users. However, because outlines sit outside the normal box, they can interact unexpectedly with surrounding content and stacking contexts; using offset or combining with other effects should be tested at different sizes. For dynamic effects, authors often prefer using shadows or carefully animated properties rather than animating outline width, because the visual outcome and performance characteristics can differ across complex compositions.

Definition

Initial value
medium
Applies to
All elements
Inherited
Yes
Computed value
Absolute length; '0' if the outline style is 'none'
Animatable
No
JavaScript syntax
object.style.outlineWidth

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff.

Syntax

outline-width: <border-width> | inherit

Values

  • thinLess than the default width.
  • thickGreater than the default width.
  • mediumDefault value.
  • <border-width>Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).
  • inherit

Example

<div class="example-wrap">
<h2>outline-width examples</h2>
<div class="box outline-thin">Outline: thin</div>
<div class="box outline-medium">Outline: medium</div>
<div class="box outline-thick">Outline: thick</div>
<div class="box outline-5px">Outline: 5px</div>
</div>
.example-wrap {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    padding: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    background: #ffffff;
}

.example-wrap h2 {
    width: 100%;
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #111827;
}

.box {
    padding: 10px 16px;
    background: #f3f9ff;
    border-radius: 8px;
    margin: 4px;
    color: #0f172a;
    font-weight: 600;
}

.outline-thin {
    outline-style: solid;
    outline-color: #0b69ff;
    outline-width: thin;
    outline-offset: 4px;
}

.outline-medium {
    outline-style: solid;
    outline-color: #0b69ff;
    outline-width: medium;
    outline-offset: 4px;
}

.outline-thick {
    outline-style: solid;
    outline-color: #0b69ff;
    outline-width: thick;
    outline-offset: 4px;
}

.outline-5px {
    outline-style: solid;
    outline-color: #0b69ff;
    outline-width: 5px;
    outline-offset: 4px;
}

Browser Support

The following information will show you the current browser support for the CSS outline-width property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!