The outline-width property controls how thick an element’s outline is. It is key for visible focus rings and emphasis without changing layout.
01
Thickness
Control outline size.
02
Keywords
thin, medium, thick.
03
Length Values
px, em, rem.
04
Default medium
Browser standard.
05
Focus Rings
Keyboard highlight.
06
No Layout Shift
Unlike borders.
Fundamentals
Introduction
The outline-width property in CSS is used to define the thickness of the outline of an element. Unlike borders, outlines do not take up space in the layout and are drawn outside the element’s border edge.
This property is useful for highlighting elements, creating focus states, or adding visual emphasis to specific parts of a webpage.
Definition and Usage
Use keyword values like thin or thick for quick sizing, or precise lengths like 2px and 3px for consistent focus rings across your design system.
Pair outline-width with outline-style and outline-color for a complete outline effect.
💡
Beginner Tip
For accessible focus rings, try outline: 2px solid #2563eb; or set outline-width: 3px; with your preferred style and color.
Foundation
📝 Syntax
The syntax for the outline-width property is simple and can be used with various values to control the thickness of the outline.
syntax.css
element{outline-width:width;}
Here, width specifies the thickness of the outline and can be a keyword or a length value.
Basic Example
outline-width.css
button{outline:solid black;outline-width:thick;}
Syntax Rules
Keywords: thin, medium, and thick.
Lengths: any valid CSS length such as px, em, or rem.
An outline needs a visible outline-style to show the width.
The outline shorthand can set width, style, and color together.
Defaults
🎯 Default Value
The default value of the outline-width property is medium, which is a browser-defined width that varies between browsers but is generally considered a standard medium thickness.
Use explicit pixel values when you need the same thickness everywhere.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
medium
Applies to
All elements
Inherited
No
Animatable
No
Common use
Focus ring thickness and visual emphasis
Reference
💎 Property Values
Value
Example
Description
thin
outline-width: thin;
A thin outline; exact width is defined by the browser
medium
outline-width: medium;
A medium outline; default browser thickness
thick
outline-width: thick;
A thick outline; exact width is defined by the browser
Length
outline-width: 3px;
A specific width using units such as px, em, or rem
Keyword widths are convenient, but exact pixel values are more consistent across browsers.
Companion
Part of the outline property set
outline-width sets thickness only. Combine it with outline-style, outline-color, and outline-offset, or use the outline shorthand.
outline-shorthand.css
/* width + style + color in one line */button:focus-visible{outline:3px solid #2563eb;}
A11y
♿ Accessibility
Use visible width — Focus outlines should be thick enough to notice, often 2px or more.
Do not set width to 0 — on focus states unless you provide another clear indicator.
Pair with contrast — Width alone is not enough; color contrast matters too.
Test keyboard focus — Verify the ring is visible on all interactive elements.
🧠 How outline-width Works
1
An outline style is set
The outline must not be none before width is visible.
Style
2
Width controls thickness
outline-width sets how bold the ring appears.
Thickness
3
Outline draws outside the border
The thicker ring does not change layout or box dimensions.
No shift
=
📐
Clear emphasis or focus ring
Elements stand out with the thickness you choose.
Compatibility
Browser Compatibility
The outline-width property is well supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. This makes it a reliable choice for styling outlines consistently across platforms.
✓ Baseline · Universal support
Excellent support everywhere
Keyword and length values for outline-width work reliably in all major browsers.
99%Global browser support
Google Chrome1+ · All versions
Full support
Mozilla Firefox1.5+ · All versions
Full support
Apple Safari1.2+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera7+ · All versions
Full support
outline-width property99% supported
Bottom line:outline-width is safe for focus and emphasis styling in modern projects.
Wrap Up
Conclusion
The outline-width property provides a simple and effective way to control the thickness of outlines on elements.
By using this property, you can enhance the visual emphasis of your webpage elements, making them more noticeable or helping to create a cohesive design. Experiment with different values to find the perfect thickness for your design needs.