The outline-style property controls the line style of an outline. It is essential for focus rings and visual emphasis without changing layout.
01
Line Style
solid, dashed, dotted.
02
Default none
Hidden by default.
03
Focus Rings
Keyboard highlight.
04
3D Styles
groove, ridge, inset.
05
Longhand Part
With width & color.
06
No Layout Shift
Unlike borders.
Fundamentals
Introduction
The outline-style property in CSS is used to define the style of an outline that is drawn around an element.
Unlike borders, outlines do not take up space and are not part of the element’s layout, but they are useful for creating visual emphasis or focus indicators.
This property is commonly used in conjunction with outline-width and outline-color to fully customize the appearance of an outline.
Definition and Usage
Set outline-style to anything other than none when you want a visible outline. Pair it with width and color for a complete focus or highlight effect.
For most accessibility-focused designs, solid is the clearest and most common choice.
💡
Beginner Tip
If your outline does not appear, check that outline-style is not none and that outline-width is greater than zero.
Foundation
📝 Syntax
The syntax for the outline-style property is simple. It specifies the style of the outline to be used.
syntax.css
element{outline-style:style;}
Here, style can be one of the predefined keyword values that define the outline’s appearance.
Use keyword values such as solid, dashed, and dotted.
none hides the outline even if width or color is set.
3D styles like groove and ridge are less common for focus rings.
The outline shorthand can set style, width, and color together.
Defaults
🎯 Default Value
The default value of the outline-style property is none. This means that if you don’t explicitly set a value, no outline will be drawn around the element.
Browsers may still show their own default focus outline on interactive elements until you style focus yourself.
Prefer solid for focus — Solid outlines are easiest for keyboard users to see.
Do not use outline-style: none on :focus — unless you provide another visible focus indicator.
Keep enough width — Thin dotted outlines may be hard to notice on some screens.
Test contrast — Style alone is not enough; color and width matter too.
🧠 How outline-style Works
1
You choose a style keyword
Values like solid, dashed, or none define the line type.
Keyword
2
Width and color complete the outline
The outline becomes visible when style is not none and width is set.
Longhand
3
Browser draws outside the border
The styled outline appears without changing element layout.
Render
=
🔲
Styled focus or emphasis ring
Elements gain a clear visual outline in the chosen line style.
Compatibility
Browser Compatibility
The outline-style property is well supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is a reliable property for creating consistent visual emphasis or focus indicators.
✓ Baseline · Universal support
Excellent support everywhere
Common values like solid, dashed, and dotted work reliably across 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-style property99% supported
Bottom line:outline-style is safe for focus and emphasis styling in modern projects.
Wrap Up
Conclusion
The outline-style property is a useful tool for adding visual emphasis or focus indicators to elements on your webpage.
By customizing the style of the outline, you can enhance the user experience and improve the accessibility of your website. Experiment with different styles to see how they can complement your design and meet your needs.