accent-color for Checkboxes and Radios
- CSS Basics
- Selectors & Specificity
- Box Model & Units
- Typography & Text Styling
- Colors & Color Spaces
- Positioning & Stacking Context
- Flexbox
- Grid
- Grid Advanced
- Responsive Design
- Container Queries
- Pseudo-classes & Pseudo-elements
- Modern Selectors
- CSS Custom Properties
- CSS Functions
- Transitions & Animations
- Transforms
- Forms & Input Styling
- CSS Architecture & Methodologies
- Accessibility in CSS
- Performance & Optimization
- View Transitions & Modern APIs
- Cascade Layers & Scope
The Problem Before accent-color
Before accent-color existed, giving a checkbox or radio button a custom brand color meant either accepting the browser's default blue, or building an entirely custom control from scratch with hidden native inputs and styled replacement elements - a fair amount of work for a small visual change.
Using accent-color
input[type="checkbox"],
input[type="radio"] {
accent-color: #1d4ed8;
}This single line recolors the checked state of native checkboxes, radio buttons, range sliders, and progress bars to match a brand color, while keeping the browser's normal native rendering, animations and accessibility behavior fully intact.
Applying It Globally or Selectively
:root {
accent-color: #1d4ed8; /* applies to all supporting form controls site-wide */
}
.danger-zone input[type="checkbox"] {
accent-color: #dc2626; /* overridden just in this section */
}accent-color inherits like most other color properties, so setting it once on :root is often enough for an entire site, with local overrides where a different color makes sense.
What accent-color Does Not Change
It only affects the checked/active color of supported controls - it does not change their size, border, spacing, or unchecked appearance. Deeper visual customization (a completely custom shape, for instance) still requires the more involved custom-control technique covered elsewhere in this section.
Why This Is Worth Using
For most projects, a small brand-colored tint on checkboxes and radios is enough to feel consistent with the rest of the design - accent-color achieves that with a single declaration and no compromise on native accessibility behavior.