W3cubDocs

/CSS

:indeterminate

The :indeterminate CSS pseudo-class represents any form element whose state is indeterminate, such as checkboxes which have their HTML indeterminate attribute set to true, radio buttons which are members of a group in which all radio buttons are unchecked, and indeterminate <progress> elements.

/* Selects any <input> whose state is indeterminate */
input:indeterminate {
  background: lime;
}

Elements targeted by this selector are:

Syntax

:indeterminate

Examples

Checkbox & radio button

This example applies special styles to the labels associated with indeterminate form fields.

HTML

<div>
  <input type="checkbox" id="checkbox">
  <label for="checkbox">This label starts out lime.</label>
</div>
<div>
  <input type="radio" id="radio">
  <label for="radio">This label starts out lime.</label>
</div>

CSS

input:indeterminate + label {
  background: lime;
}

JavaScript

var inputs = document.getElementsByTagName("input");

for (var i = 0; i < inputs.length; i++) {
  inputs[i].indeterminate = true;
}

Progress bar

HTML

<progress>

CSS

progress {
  margin: 4px;
}

progress:indeterminate {
  opacity: 0.5;
  background-color: lightgray;
  box-shadow: 0 0 2px 1px red;
}

Result

Specifications

Specification Status Comment
HTML Living Standard
The definition of ':indeterminate' in that specification.
Living Standard No change.
HTML5
The definition of ':indeterminate' in that specification.
Recommendation Defines the semantics of HTML and constraint validation.
Selectors Level 4
The definition of ':indeterminate' in that specification.
Working Draft No change.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
:indeterminate 1 12 2 10 9 3
Applies to <input type="checkbox"> elements 1 12 3.6 10 10.6 3
Applies to <progress> elements 6 12 6 10 15 5.1
Applies to <input type="radio"> elements 39 79 51 No 26 No
No
See WebKit bug 156270.
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
:indeterminate ≤37 18 4 10.1 1 1.0
Applies to <input type="checkbox"> elements ≤37 18 4 11 1 1.0
Applies to <progress> elements 37 18 6 14 5 1.0
Applies to <input type="radio"> elements 39 39 51 26 No
No
See WebKit bug 156270.
4.0

See also

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate