CSS Reference ยท Pseudo-classes
The :indeterminate pseudo-class
Reference for the CSS :indeterminate pseudo-class: style mixed-state checkboxes, unselected radio groups and indeterminate progress bars, with examples.
The :indeterminate pseudo-class matches form controls whose state is neither on nor off. Three cases qualify: a checkbox whose indeterminate DOM property is true, a radio button whose whole group has nothing selected, and a <progress> element with no value attribute.
The classic use is a "select all" checkbox that shows a dash when only some of its children are ticked. There is no HTML attribute for that state; scripts set it.
input[type="checkbox"]:indeterminate { accent-color: #d97706; }
Try it
Syntax
:indeterminate { /* declarations */ }
- Applies to: checkboxes, radio buttons and
<progress>elements. - Specificity: (0,1,0), like any pseudo-class.
- Inherited / animatable: not applicable.
Values
| Syntax and arguments | Description |
|---|---|
:indeterminate |
No arguments. Matches a checkbox with indeterminate = true, a radio in a group with no checked member, or a <progress> without a value. |
Usage notes
- Visual only. The
indeterminateproperty changes how the box looks. It does not changecheckedor what the form submits, so keepcheckedcorrect yourself. - Clicking clears it. When the user activates an indeterminate checkbox, the browser sets
indeterminateback tofalse. - Radio groups. Every radio in a group with no selection matches, which is a handy way to flag "nothing chosen yet" (although
:required:invalidoften says the same thing). - Accessibility. Browsers expose the state as
aria-checked="mixed", so assistive technology hears it. Do not rely on colour alone to tell it apart. - Progress bars. An indeterminate
<progress>means "working, unknown duration". Style it withaccent-color; the animation itself is the browser's.
Browser support
Supported in all current browsers.
Related
:checkedโ on/off state:requiredโ required controls:validโ constraint validation- Lesson: Styling Forms