W3cubDocs

/CSS

:indeterminate

The :indeterminate CSS pseudo-class represents any form element whose state is indeterminate.

/* 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.
CSS Basic User Interface Module Level 3
The definition of ':indeterminate' in that specification.
Proposed Recommendation Defines the pseudo-class, but not the associated semantics.

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes Yes Yes Yes Yes
type="checkbox" ? Yes 3.6 9 10.6 3
type="radio" 39 No1 51 No ? No2
<progress> 6 Yes 6 10 ? Yes
Feature Android webview Chrome for Android Edge mobile Firefox for Android Opera Android iOS Safari Samsung Internet
Basic support ? ? Yes Yes ? ? ?
type="checkbox" ? ? Yes 4 ? ? ?
type="radio" 39 ? No1 51 ? No2 ?
<progress> ? ? Yes 6 ? ? ?

1. See Edge bug 7124038.

2. See WebKit bug 156270.

© 2005–2018 Mozilla Developer Network 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