CSS :indeterminate Selector

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 4 Examples
Form States

What You’ll Learn

The :indeterminate pseudo-class styles checkboxes and other controls in a partial or unknown state — neither fully checked nor unchecked.

01

Third state

Partial check.

02

Select All

Parent checkbox.

03

JavaScript

Set via JS.

04

:checked

Not the same.

05

progress

Unknown load.

06

accent-color

Easy styling.

Introduction

The :indeterminate selector in CSS targets checkboxes or radio buttons that are in an indeterminate state. This typically occurs when a checkbox’s selection is unclear, such as when it is partially checked.

It is commonly used in “Select All” patterns where some child options are checked but not all of them, giving users a clear visual cue for partial selection.

Definition and Usage

Use :indeterminate on its own or with an element selector: input[type="checkbox"]:indeterminate. The state must be set in JavaScript — there is no HTML attribute for indeterminate.

💡
Beginner Tip

Set the state with checkbox.indeterminate = true in JavaScript, then style it with CSS. An indeterminate checkbox is not :checked — it is a separate third state.

📝 Syntax

The syntax for the :indeterminate pseudo-class is:

syntax.css
:indeterminate {
  /* CSS properties */
}

The :indeterminate pseudo-class applies to <input type="checkbox">, <input type="radio">, and <progress> elements in an indeterminate state.

Basic Example

indeterminate.css
input[type="checkbox"]:indeterminate {
  accent-color: #eab308;
}

input[type="checkbox"]:checked {
  accent-color: #16a34a;
}
input:indeterminate input[type="checkbox"]:indeterminate progress:indeterminate :checked

Three Checkbox States

StatePseudo-classHow it is set
Unchecked(default — no pseudo-class)Default or checked removed
Checked:checkedchecked attribute or user click
Indeterminate:indeterminateJavaScript: .indeterminate = true

Syntax Rules

  • Indeterminate must be set via JavaScript — no HTML attribute exists.
  • An indeterminate checkbox does not match :checked.
  • accent-color is the easiest way to tint native checkboxes in modern browsers.
  • Style :indeterminate before or with higher specificity than :checked when both could apply after state changes.
  • <progress> without a value is natively indeterminate.

Related Selectors

  • :checked — fully selected checkboxes and radios
  • :default — the default selected option in a form
  • :disabled — inactive controls that cannot be changed
  • :has() — style a parent when it contains an indeterminate child
  • progress element — shows loading; indeterminate when value is unknown

⚡ Quick Reference

QuestionAnswer
Selector typePseudo-class (UI state)
When it appliesControl is in partial/unknown state
Set in HTML?No — JavaScript only for checkboxes
JS syntaxelement.indeterminate = true
Common use“Select All” parent checkbox
Browser supportAll modern browsers

When to Use :indeterminate

:indeterminate improves multi-select and loading UIs:

  • Select All checkboxes — Show a dash when some but not all child items are selected.
  • Tree views and categories — Indicate partial selection in nested option lists.
  • Data tables — Header checkbox reflects mixed row selection state.
  • Progress bars — Style <progress> when loading duration is unknown.
  • Form wizards — Visual distinction between all, none, and some options selected.

👀 Live Preview

The “Select All” checkbox below is in an indeterminate state (amber accent). Child options show checked and unchecked states:

Select your preferences

Examples Gallery

Practice :indeterminate with Select All checkboxes, accent colors, label styling, and progress bars.

📜 Core Patterns

Style the partial-selection state on checkboxes.

Example 1 — Select All with indeterminate state

Style a parent checkbox when some child options are selected using JavaScript and :indeterminate.

indeterminate-select-all.html
<style>
  input:indeterminate {
    accent-color: #eab308;
  }
  input:checked {
    accent-color: #16a34a;
  }
</style>

<input type="checkbox" id="selectAll">
<label for="selectAll">Select All</label>
<input type="checkbox" id="opt1" checked> <label for="opt1">Option 1</label>
<input type="checkbox" id="opt2"> <label for="opt2">Option 2</label>

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

How It Works

JavaScript sets indeterminate = true on the parent checkbox. CSS :indeterminate styles it amber while :checked styles fully selected items green.

Example 2 — Distinct accent colors per state

Use accent-color to differentiate unchecked, checked, and indeterminate checkboxes.

indeterminate-accent.css
input[type="checkbox"] {
  accent-color: #94a3b8;
  width: 1.1rem;
  height: 1.1rem;
}

input[type="checkbox"]:checked {
  accent-color: #16a34a;
}

input[type="checkbox"]:indeterminate {
  accent-color: #eab308;
}
Try It Yourself

How It Works

Default gray applies to unchecked boxes. :checked overrides to green, and :indeterminate overrides to amber when the JS property is set.

📄 Labels & Progress

Extend indeterminate styling to labels and loading indicators.

Example 3 — Highlight label for indeterminate checkbox

Style the label text when its checkbox is in an indeterminate state using the adjacent sibling combinator.

indeterminate-label.css
input:indeterminate + label {
  color: #a16207;
  font-weight: 700;
  background: #fef9c3;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
}

input:checked + label {
  color: #15803d;
  font-weight: 600;
}
Try It Yourself

How It Works

input:indeterminate + label targets the label immediately following an indeterminate checkbox, adding an amber highlight to draw attention to the partial state.

Example 4 — Indeterminate progress bar

A <progress> element without a value is natively indeterminate — useful for unknown loading duration.

indeterminate-progress.css
progress:indeterminate {
  accent-color: #2563eb;
  width: 100%;
  height: 0.65rem;
}

progress {
  border-radius: 0.35rem;
}
Try It Yourself

How It Works

<progress> without a value attribute matches :indeterminate and shows an animated loading bar in supporting browsers.

💬 Usage Tips

  • JavaScript required — Set checkbox.indeterminate = true; there is no HTML attribute.
  • Pair with :checked — Style all three states: default (unchecked), :checked, and :indeterminate.
  • Select All logic — Set indeterminate when some children are checked; clear it when all or none are checked.
  • accent-color — The simplest cross-browser approach for native checkbox tinting.
  • progress element — Use <progress> without value for unknown-duration loading.

⚠️ Common Pitfalls

  • No HTML indeterminate attribute — The old indeterminate HTML attribute does not exist; use JavaScript only.
  • Not the same as :checked — Indeterminate checkboxes do not match :checked; style both separately.
  • :unchecked is non-standard — Avoid relying on :unchecked; use the default style for unchecked boxes instead.
  • Clicking clears indeterminate — User interaction typically resets indeterminate to checked or unchecked.
  • Browser rendering differences — The dash icon and accent-color support vary; test in major browsers.

♿ Accessibility

  • aria-checked="mixed" — Mirror the indeterminate visual state for screen readers with this ARIA attribute.
  • Label every checkbox — Use <label for="..."> so assistive tech announces the control name.
  • Do not rely on color alone — The browser’s dash icon plus label text should convey partial selection.
  • Keyboard support — Indeterminate checkboxes remain focusable and operable via Space key.
  • State announcements — Consider live regions or ARIA updates when toggling between all, none, and mixed states.

🧠 How :indeterminate Works

1

JavaScript sets state

checkbox.indeterminate = true puts the control in a partial state.

JS
2

:indeterminate matches

The browser marks the element as indeterminate — not checked, not unchecked.

Match
3

CSS styles apply

Accent color, labels, or custom rules highlight the partial state.

Style
=

Clear partial selection

Users see that some — but not all — options are selected.

🖥 Browser Compatibility

The :indeterminate pseudo-class is supported in all modern browsers.

Baseline · Modern browsers

Indeterminate styling everywhere

:indeterminate works in Chrome, Firefox, Safari, and Edge for checkboxes and progress elements.

97% Global support
Google Chrome 20+ · Desktop & Mobile
Full support
Mozilla Firefox 4+ · Desktop & Mobile
Full support
Apple Safari 5.1+ · macOS & iOS
Full support
Microsoft Edge 12+
Full support
Opera 11+
Full support
:indeterminate pseudo-class 97% supported

Bottom line: Safe for modern Select All and progress bar UIs. Test checkbox appearance across browsers.

🎉 Conclusion

The :indeterminate selector lets you style form elements in an ambiguous partial state, making “Select All” and mixed-selection UIs more intuitive.

Combine JavaScript to set the state, CSS to style it, and aria-checked="mixed" for accessibility. Pair with :checked for a complete three-state checkbox experience.

💡 Best Practices

✅ Do

  • Set indeterminate via JavaScript
  • Style :indeterminate, :checked, and default states
  • Use for Select All parent checkboxes
  • Add aria-checked="mixed" for screen readers
  • Clear indeterminate when all/none are selected

❌ Don’t

  • Expect an HTML indeterminate attribute
  • Treat indeterminate as :checked
  • Rely on the non-standard :unchecked pseudo-class
  • Depend on color alone for partial state
  • Forget to update state when children change

Key Takeaways

Knowledge Unlocked

Five things to remember about :indeterminate

Use these points when styling partial checkbox states.

5
Core concepts
JS 02

.indeterminate

Set via script.

HTML
03

Not :checked

Separate state.

Rule
All 04

Select All

Top use case.

Pattern
🌐 05

97% support

All browsers.

Compat

❓ Frequently Asked Questions

The :indeterminate pseudo-class matches form controls in an indeterminate state — neither fully checked nor unchecked. It is commonly used for a "Select All" checkbox when only some child options are selected.
No. There is no HTML attribute for indeterminate. You must set it with JavaScript: checkbox.indeterminate = true. The visual dash or partial state is then styleable with :indeterminate.
No. An indeterminate checkbox is not :checked. It is a third state between checked and unchecked, used to represent partial selection.
Primarily input[type="checkbox"] and input[type="radio"]. The progress element also matches :indeterminate when it has no value (unknown progress).
:indeterminate is supported in all modern browsers including Chrome, Firefox, Safari, and Edge. Always test checkbox appearance across browsers.

Practice in the Live Editor

Open the HTML editor and experiment with :indeterminate, Select All checkboxes, and progress bars.

HTML Editor →

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.

5 people found this page helpful