Skip to content

Focus Indicator CSS Generator

Generate accessible CSS focus indicator styles that meet WCAG 2.2's new focus appearance requirements. Configure outline color, width, offset, and style. The tool checks compliance with WCAG 2.4.11 (Focus Not Obscured) and 2.4.13 (Focus Appearance) and generates copy-ready CSS.

Why This Matters

Visible focus indicators are essential for keyboard navigation. Many developers remove the default browser outline (outline: none) without providing a replacement, making keyboard navigation impossible for users with motor or visual impairments. WCAG 2.2 introduced SC 2.4.11 (Focus Not Obscured, AA) and 2.4.13 (Focus Appearance, AAA) with specific measurable requirements for focus indicator size and contrast.

How to Use This Tool

  1. 1

    Choose a style

    Select from CSS outline, box-shadow, border, background highlight, or a combined approach.

  2. 2

    Configure colors

    Pick an outline color and adjust width and offset to meet WCAG requirements.

  3. 3

    Check compliance

    The tool verifies your configuration against WCAG 2.4.11 and 2.4.13 in real time.

  4. 4

    Copy CSS

    Copy the generated CSS or download it as a .css file for your project.

Frequently Asked Questions

What is WCAG 2.4.11 (Focus Not Obscured)?

New in WCAG 2.2 at Level AA. The keyboard focus indicator must not be entirely hidden by author-created content. The focused component must be at least partially visible when it receives focus.

What is WCAG 2.4.13 (Focus Appearance)?

New in WCAG 2.2 at Level AAA. The focus indicator must have a minimum area of the CSS pixel perimeter of the unfocused component and a contrast ratio of at least 3:1 between focused and unfocused states.

Should I use :focus or :focus-visible?

:focus-visible is recommended. It shows the focus indicator only for keyboard navigation (not mouse clicks), providing a cleaner experience for mouse users while still supporting keyboard users. All modern browsers support it.

Why is box-shadow sometimes better than outline?

If a parent element has overflow:hidden, CSS outlines can be clipped and become invisible. Box-shadow is not affected by overflow and can be a reliable alternative in those cases.

Related Tools