To make a CSS checkbox look checked, use the :checked pseudo-class and add a visible mark with input:checked::after. Because :checked reflects the input’s current state, the custom appearance follows a mouse click, touch interaction, or Space activation.
An important distinction is that :checked does not set the checkbox state. Use the HTML checked attribute when a form should start with an option selected, then let the browser and surrounding form manage later changes. The CSS Checkbox Generator styles the native input; it does not replace the input with a generic div or create a second application state.

Why :checked belongs on the native input
Apply state selectors to the actual input type="checkbox", not to a decorative span placed beside it. The generated pattern uses .lizely-checkbox for the base appearance, .lizely-checkbox:checked for selected colors, .lizely-checkbox:checked::after for the mark, and .lizely-checkbox:focus-visible for the focus ring. Keeping the native element in place lets the CSS reflect what the browser actually considers checked.
A minimal labeled structure looks like this:
<label class="choice"><input type="checkbox" name="updates"> Receive product updates</label>
The MDN appearance reference and W3C CSS Basic User Interface Level 4 describe the property and its compatibility considerations. Here, appearance: none suppresses native drawing while the element remains an input type="checkbox". It does not remove the browser’s checked state, keyboard focus, form participation, or disabled behavior when the surrounding application applies those features correctly.
Map each part of the checked appearance
The generated stylesheet divides the visual work across four hooks. Each hook has a focused purpose, so you can adjust the selected state without rebuilding the whole control.
| CSS hook | Visual responsibility | Practical result |
|---|---|---|
| .lizely-checkbox | Sets appearance: none and defines the square size, border, radius, background, relative positioning, border-box sizing, and pointer cursor. | Creates a consistent custom box before any state change. |
| .lizely-checkbox:checked | Changes the checked background and border colors only while the input is selected. | Makes the selected state immediately recognizable. |
| .lizely-checkbox:checked::after | Creates the mark with right and bottom borders, scaled dimensions, proportional positioning, and a 45-degree rotation. | Draws the checkmark only during the checked state. |
| .lizely-checkbox:focus-visible | Adds an accent-colored outline with an offset. | Keeps keyboard focus visible instead of removing it. |
The selected size includes the visible border because the output uses box-sizing: border-box. The checkmark’s width, height, and border thickness scale from the chosen box size, with minimum values that keep it visible at the smallest supported size. These ratios are product choices rather than universal CSS standards. At unusual zoom levels, device pixel ratios, or extreme border settings, antialiasing can make one edge of the mark appear slightly heavier.
Generate and apply the checked style
- Open the CSS Checkbox Generator and set the geometry. Use a whole-pixel size from 16 through 64, a border from 1 through 6 pixels, and a radius from 0% through 50%. Out-of-range geometry is rejected rather than silently producing misleading code.
- Enter complete six-digit HEX values for the accent, background, and checkmark colors. The generator rejects malformed colors and decimals where integers are required.
- Exercise both states in the live preview. It uses the exact generated stylesheet in the scoped .lizely-checkbox class. Click the box or its preview label to compare the checked and unchecked appearances; the ::after mark appears only when the input is checked.
- Use the separate Copy CSS and Copy HTML controls. Each requests clipboard permission independently, and the success message identifies which output was copied. If permission is denied, both code blocks remain available for manual selection instead of reporting a false success. Generation and copying happen in the current browser tab, with no account, upload, stylesheet service, or saved design state.
- Paste the CSS into a controlled stylesheet and the HTML into the destination form. If you rename the generated class, update both the CSS selector and the input’s class attribute. Preserve the native input and its label relationship. The generated HTML contains no inline script, and the browser and surrounding form remain responsible for the checkbox state.
- Replace the example label wording with a meaningful description of the real choice. Keeping visible text inside the label gives the checkbox an accessible name and lets people toggle it by clicking that text. Framework users can translate class to className and connect checked or onChange as required, but should retain the native input.
- Test the result in the destination rather than relying on the preview alone. Check Tab order, visible focus, Space activation, label clicking, contrast, 200% zoom, error presentation, disabled behavior, and forced-colors mode. The generator page contains many focusable controls, so its preview cannot verify the final form’s order or instructions.
Keep the checked control usable
A visible checkmark handles only the visual state. The generated focus-visible outline is intentionally retained because keyboard users need to see which control will respond to Space. Its color matches the selected accent, but your site may need a different outline color or width to achieve sufficient contrast against the actual surrounding page.
Use a color contrast checker to review relevant foreground and background color pairs, then inspect the border, mark, and focus indicator directly in the destination theme. A passing color pair does not by itself verify an accessible name, logical focus order, or usable error message.
The generator’s baseline covers unchecked, checked, and focus-visible states. Its preview does not simulate indeterminate, invalid, required, disabled, read-only, high-contrast, or forced-colors states. Add and verify those states when the real product needs them. Operating-system forced colors may override the custom palette, which can be beneficial; test that mode and avoid defeating useful accessibility overrides without a strong reason.
Diagnose a checked mark that does not appear
Separate a state problem from a drawing problem before changing the generated CSS.
- Confirm the input is actually checked. The :checked selector matches the current state, not the visual intention. Inspect the live input after a click or Space activation.
- Check the selector target. The .lizely-checkbox class must be on the native input, and the rule must use :checked::after. A pseudo-element is created by CSS rather than inserted as a child of the input.
- Verify the pseudo-element content. The generated checked rule supplies the content needed to draw the mark. Removing that declaration or replacing the complete rule can leave the box colored but unmarked.
- Look for later CSS overrides. A framework reset, base class, or more specific rule may replace the generated checked background, border, or pseudo-element styles.
- Distinguish a clipboard problem from a CSS problem. If permission was denied, select the visible code manually and confirm that the preview and pasted blocks match.
For a systematic comparison of the generated selectors and output, use this step-by-step guide to troubleshooting CSS Checkbox Generator output.
If you're weighing options, CSS Easing Cubic Bezier Generator: Tune the Four Controls covers this in detail.