Open any checkbox, copy the HTML into your form and the CSS into your stylesheet. The real <input type="checkbox"> stays in the page (restyled, never display: none), wrapped in its <label>, so clicking the text, the keyboard and form submission all work.
To change the color, set --chk-color on the checkbox or any ancestor. To change the size, set --chk-size: the box, checkmark and label all scale from it.
Every snippet keeps a visible :focus-visible ring and ships with a prefers-reduced-motion rule that shows the checked state instantly for people who asked their OS for less motion.
For a one-line color change use accent-color. For full control set appearance: none on the input, draw the box and checkmark with borders or pseudo-elements, and style the :checked state.
Set width and height on an appearance: none checkbox, or raise --chk-size on any snippet here, and use your own :checked background or accent-color.
Add border-radius: 50% to a custom appearance: none checkbox. The round entries above also animate the checkmark in.
Draw the check as an SVG path and animate stroke-dashoffset from its full length to zero when the input is :checked, or rotate and scale an L-shaped border.
Yes, if the real input stays in the page, is wrapped by or tied to a label, and keeps a visible focus style. Hiding it with display: none removes it from the keyboard and screen readers.