CSS :indeterminate Pseudo-class

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The :indeterminate pseudo-class matches a form control in an indeterminate state — neither fully on nor off.

It applies to checkboxes with indeterminate = true (set in JavaScript), radio buttons in a group where none are checked, and <progress> elements with no value attribute. It is not the same as :checked.

Baseline · Widely available.

Not deprecated. Standard Selectors Level 4 / HTML pseudo-class. Cross-browser support for the common cases is strong in modern browsers.

Note No HTML attribute for checkboxes

There is no indeterminate HTML attribute. Use JavaScript: checkbox.indeterminate = true. A user click usually clears that flag.

CSS Syntax

syntax.css
:indeterminate { /* styles when indeterminate */ }

Often combined with a type or sibling: input:indeterminate + label or progress:indeterminate.

Common Patterns

PatternDescriptionTry it
CheckboxSet indeterminate in JS, then style with CSSTry it
Label siblinginput:indeterminate + label styles the labelTry it
Radio groupMatches when no radio in the named group is checkedTry it
Progressprogress with no value is indeterminateTry it

How to Use :indeterminate

Create the indeterminate state first, then style it (or its neighbors).

  1. For checkboxes, set element.indeterminate = true in JavaScript (often for Select All).
  2. For radios, leave the whole named group unchecked to start.
  3. For progress, omit the value attribute until you know the amount.
  4. Style with :indeterminate and/or + label; keep labels accessible with for/id.

Live Preview

Toggle the checkbox’s indeterminate flag, pick a radio, and watch the valueless progress bar. Labels turn green while the matching control is :indeterminate.

Form sample

Uses input:indeterminate + label and progress:indeterminate.

Interactive
Plan

Checking…

CSS Examples

Each snippet focuses on :indeterminate. Use Try It Yourself for a live editor.

Example 1 — Indeterminate Checkbox + Label

Set a checkbox to indeterminate in JavaScript, then style its label.

CSS
<style>
  input:indeterminate + label {
    color: #16a34a;
    font-weight: 700;
  }
</style>

<input type="checkbox" id="all">
<label for="all">Select all</label>

<script>
  document.getElementById("all").indeterminate = true;
</script>
Try It Yourself

How It Works

  1. No HTML flag. The box starts normal until script runs.
  2. Set the DOM property. indeterminate = true creates the partial state.
  3. Style the sibling label. input:indeterminate + label turns the text green.
  4. Click clears it. A user click usually drops indeterminate and toggles checked.

Example 2 — Unchecked Radio Group

Radios in a named group match :indeterminate until one is selected.

CSS
<style>
  input[type="radio"]:indeterminate + label {
    color: #16a34a;
    font-weight: 700;
  }
</style>

<input type="radio" name="size" id="s">
<label for="s">Small</label>
<input type="radio" name="size" id="l">
<label for="l">Large</label>
Try It Yourself

How It Works

  1. Share a name. Both radios use name="size".
  2. Leave none checked. The whole group starts indeterminate.
  3. Style every member. Each radio matches until one is chosen.
  4. Pick one. Selecting a radio clears indeterminate for the group.

Example 3 — Progress Without a Value

A progress element with no value matches :indeterminate.

CSS
<style>
  progress:indeterminate {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
  }
</style>

<progress></progress>
Try It Yourself

How It Works

  1. Omit value. Unknown progress is indeterminate by default.
  2. Match with CSS. progress:indeterminate targets that state.
  3. Add a clear cue. A green outline marks the busy / unknown bar.
  4. Set a value later. Adding value (and usually max) ends the match.

Edge Cases & Pitfalls

Indeterminate is a real UI state — wire it with JS where HTML cannot.

vs :checked

Third state, not checked

An indeterminate checkbox does not match :checked. Style both states separately for Select All UIs.

HTML

No indeterminate attribute

Unlike checked, you cannot mark a checkbox indeterminate in markup. Always set the DOM property in script.

click

User interaction clears the flag

Clicking or pressing Space on an indeterminate checkbox typically sets indeterminate back to false and toggles checked.

a11y

Announce partial selection

Pair visual styles with clear label text (for example “Select all — some selected”) so assistive tech users understand the partial state.

Browser Support

:indeterminate is a browser CSS pseudo-class. Node.js, Deno, and Bun do not evaluate it.

✓ Baseline · Widely available

:indeterminate

Chrome 39+, Edge 79+, Firefox 51+, Safari 10+, Opera 26+. Internet Explorer has only partial / limited support.

97% Global reach
Google Chrome 39+
Full support
Mozilla Firefox 51+
Full support
Apple Safari 10+
Full support
Microsoft Edge 79+
Full support
Opera 26+
Full support
Samsung Internet 4+
Full support
Internet Explorer 9โ€“11
Partial support
:indeterminate Widely supported

Bottom line: Safe for modern form UIs. Prefer progressive enhancement for Select All patterns. It is not a server runtime API.

Key Takeaways

  • Role: style controls that are neither fully on nor off.
  • Targets: JS checkboxes, unchecked radio groups, valueless progress.
  • vs :checked: a separate third state for checkboxes.
  • Practice: set checkbox state in JS; style with :indeterminate.

One line: when the UI is only partly decided, mark the control indeterminate and style that state in CSS.

Frequently Asked Questions

It matches form controls in an indeterminate state: checkboxes with the JS indeterminate property set to true, radio buttons in a group where none are checked, and progress elements with no value attribute.
No. There is no HTML attribute for checkbox indeterminate. Set it with JavaScript: checkbox.indeterminate = true.
No. An indeterminate checkbox is a third state. It does not match :checked until the user checks it (which also clears indeterminate).
Checkboxes (via JS), radio buttons when their named group has no checked member, and progress elements without a value.
When some child options are selected, set the parent checkbox to indeterminate so the UI shows a partial state between none and all.
No. It is a CSS pseudo-class evaluated by the browser. Setting checkbox.indeterminate is a DOM property, not a Node.js feature.

Next: :invalid

Learn the :invalid pseudo-class for form validation feedback.

:invalid tutorial →

About the author

Mari Selvan M P
Mari Selvan M P ๐Ÿ”—

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful