Outline Generator
Set outline width, style, color and offset. Compare a border, or open Focus indicator tester to check contrast against adjacent colors and the area changed by the ring.
Compare CSS Outlines and Keyboard Focus
Outline and border preview
Focus Start here, then press Tab to test the ring.
- Contrast against surrounding fill
- 6.89 to 1
- Contrast against control fill
- 7.26 to 1
Generated stylesheet
Outline Generator: how to use it
- Enter an outline style, width and color. Set the offset to move the stroke toward or away from the button’s edge.
- Compare the outline and border samples. Open Focus indicator tester to check a solid ring against its surrounding colors and measure the area changed on focus.
- Choose Keyboard focus or Always visible, then copy or download the stylesheet.
Limits and notes
Outline widths range from 0 to 14 px and offsets from −14 to 18 px. Colors are sRGB. The focus tester models a solid ring using the entered box and background colors. Rounded outlines use estimated area. Verify clipping and the actual keyboard experience in your application.
How your privacy works →Outline Generator: common questions
Do I need padding or margin to make room for an outline?
An outline does not add space to the box. Give it visual clearance from nearby elements and check any clipping ancestors when you apply the rule.
What does a negative outline offset do?
It draws the outline inward. When the offset is negative by more than the stroke width, the painted stroke sits inside the element edge in the sample.
Does the displayed contrast establish focus accessibility?
It measures blended solid colors against each preview fill. Verify the actual focused control with keyboard navigation, surrounding content and the theme in which it appears.