The outline property is a shorthand for outline-width, outline-style, and outline-color. It draws a line outside the border edge and does not take layout space.
Use it for focus rings and emphasis. Unlike border, changing the outline will not push neighbors. Gap from the border is controlled separately with outline-offset.
Baseline · Widely available.
Not deprecated. Do not remove default focus outlines without a clear replacement. The old invert outline color is not supported in modern browsers.
Border is inside the box model. A 6px border adds to the element’s outer size (unless you use box-sizing: border-box carefully).
Outline paints outside. The second box keeps the same content size; the ring overlaps nearby space.
Same visual weight, different job. Use border for structure; use outline for focus and temporary emphasis.
Corners. Modern browsers often follow border-radius for outlines too.
Edge Cases & Pitfalls
If the outline is missing or focus looks broken, check these first.
a11y
Never drop focus without a replacement
outline: none on interactive controls must come with a visible :focus / :focus-visible style (WCAG focus visible).
style
No style means no outline
Initial outline-style is none. Width and color alone usually will not show a line.
offset
outline-offset is not in the shorthand
Set outline-offset on its own. The shorthand only covers width, style, and color.
invert
invert is obsolete in practice
Modern browsers do not support outline-color: invert. Use an explicit color or currentColor.
space
Outlines can overlap neighbors
Because they sit outside the box, thick outlines may paint over nearby content. Add offset or spacing if needed.
Compatibility
Browser Support
outline is a browser CSS property for visual rings and focus indicators. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available
outline
Supported across modern browsers for decades (Chrome, Firefox, Safari, Edge, IE 8+). Safe for production focus styles.
99%Global support
Google ChromeAll modern versions
Full support
Mozilla FirefoxAll modern versions
Full support
Apple SafariAll modern versions
Full support
Microsoft EdgeAll modern versions
Full support
OperaAll modern versions
Full support
Samsung InternetSupported
Full support
Internet Explorer8+
Full support
outlineWidely supported
Bottom line: Use freely for focus indicators. Do not rely on invert. This is not a JavaScript runtime API.
Remember
Key Takeaways
Role: shorthand for width, style, and color of a non-layout ring outside the border.
Style first: without a style other than none, you usually see nothing.
Not border: outline does not change the box size; border can.
Focus: keep a visible indicator — replace the default ring, don’t delete it.
One line:outline paints a freestanding ring for emphasis and focus — style it, don’t silence it.
Frequently Asked Questions
It is a shorthand for outline-width, outline-style, and outline-color. It draws a line around an element outside the border and does not take up layout space.
A border is part of the box model and can change size and layout. An outline sits outside the border box, does not affect layout, and is often used for focus rings.
outline-style defaults to none. You must set a style such as solid, or the outline will not show for most elements.
No. Setting outline: none or 0 without a replacement fails keyboard focus visibility. Provide a clear :focus or :focus-visible style instead.
No. The shorthand’s initial values are medium, none, and auto/currentColor for color. Set it on each element that needs an outline.
It is Baseline Widely available in all modern browsers. It is a browser CSS property, not a Node.js feature. The old invert outline color is not supported in current browsers.