This translation is incomplete. Please help translate this article from English.

La pseudo-class CSS :indeterminate representa qualsevol element de formulari, l'estat del qual, sigui indeterminat.

/* Selecciona qualsevol <input> l'estat del qual sigui indeterminat */
input:indeterminate {
  background: lime;
}

Els elements als quals apunta aquest selector són:

Sintaxi

:indeterminate

Exemples

Checkbox & radio button

Aquest exemple aplica estils especials a les etiquetes associades a camps de formulari indeterminats.

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;
}

Resultat

Especificacions

Especificació Estat Comentari
HTML Living Standard
The definition of ':indeterminate' in that specification.
Living Standard Sense canvis
HTML5
The definition of ':indeterminate' in that specification.
Recommendation Defineix la semàntica d'HTML i la validició de restriccions
Selectors Level 4
The definition of ':indeterminate' in that specification.
Working Draft Sense canvis
CSS Basic User Interface Module Level 3
The definition of ':indeterminate' in that specification.
Recommendation Defineix la pseudo-class, però no la semàntica associada.

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android Full support YesOpera Android ? Safari iOS ? Samsung Internet Android ?
type="checkbox"Chrome ? Edge Full support YesFirefox Full support 3.6IE Full support 9Opera Full support 10.6Safari Full support 3WebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS ? Samsung Internet Android ?
type="radio"Chrome Full support 39Edge No support No
Notes
No support No
Notes
Notes See Edge bug 7124038.
Firefox Full support 51IE No support NoOpera ? Safari No support No
Notes
No support No
Notes
Notes See WebKit bug 156270.
WebView Android Full support 39Chrome Android ? Edge Mobile No support No
Notes
No support No
Notes
Notes See Edge bug 7124038.
Firefox Android Full support 51Opera Android ? Safari iOS No support No
Notes
No support No
Notes
Notes See WebKit bug 156270.
Samsung Internet Android ?
<progress>Chrome Full support 6Edge Full support YesFirefox Full support 6IE Full support 10Opera ? Safari Full support YesWebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android Full support 6Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

Document Tags and Contributors

Contributors to this page: fscholz, Legioinvicta
Last updated by: fscholz,