mozilla

Revision 41052 of :indeterminate

  • Revision slug: CSS/:indeterminate
  • Revision title: :indeterminate
  • Revision id: 41052
  • Created:
  • Creator: fryn
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ CSSRef() }}

Summary

The :indeterminate CSS pseudo-class matches <input type="checkbox"> elements whose indeterminate DOM property is set to true by JavaScript. In addition, in some browsers, it can be used to match to {{ HTMLElement("progress") }} elements in an indeterminate state.

Examples

W3C CSS3 Selectors test#177

<style>
       input, span { background: red }
       :indeterminate, :indeterminate + span { background: limegreen }
</style>

<p><input type=checkbox> <span>Everything in this paragraph should have a green background.</span></p>

<script> document.getElementsByTagName("input")[0].indeterminate = true; </script>

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Checkboxes {{ CompatVersionUnknown() }} {{ CompatGeckoDesktop("1.9.2") }} 9.0 10.60 (2.6) 3.0
{{ HTMLElement("progress") }} {{ CompatUnknown() }} {{ CompatGeckoDesktop("6.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Checkboxes {{ CompatUnknown() }} {{ CompatGeckoMobile("1.9.2") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
{{ HTMLElement("progress") }} {{ CompatUnknown() }} {{ CompatGeckoDesktop("6.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

Specifications

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h3>Summary</h3>
<p>The<code> :indeterminate </code>CSS <a href="/en/CSS/Pseudo-classes" title="en/CSS/Pseudo-classes">pseudo-class</a> matches<code> &lt;input type="checkbox"&gt; </code>elements whose<code> indeterminate </code>DOM property is set to<code> true </code>by JavaScript. In addition, in some browsers, it can be used to match to {{ HTMLElement("progress") }} elements in an indeterminate state.</p>
<h3>Examples</h3>
<p><a class="external" href="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/full/flat/css3-modsel-d5.html" title="http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/full/flat/css3-modsel-d5.html">W3C CSS3 Selectors test#177</a></p>
<pre>&lt;style&gt;
       input, span { background: red }
       :indeterminate, :indeterminate + span { background: limegreen }
&lt;/style&gt;

&lt;p&gt;&lt;input type=checkbox&gt; &lt;span&gt;Everything in this paragraph should have a green background.&lt;/span&gt;&lt;/p&gt;

&lt;script&gt; document.getElementsByTagName("input")[0].indeterminate = true; &lt;/script&gt;
</pre>
<h3>Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>Checkboxes</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatGeckoDesktop("1.9.2") }}</td> <td>9.0</td> <td>10.60 (2.6)</td> <td>3.0</td> </tr> <tr> <td>{{ HTMLElement("progress") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoDesktop("6.0") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Checkboxes</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoMobile("1.9.2") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> <tr> <td>{{ HTMLElement("progress") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatGeckoDesktop("6.0") }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody>
</table>
</div>
<h3>Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-selectors/#indeterminate" rel="external
    nofollow" target="_blank" title="http://www.w3.org/TR/css3-selectors/#indeterminate">CSS 3 Selectors #indeterminate</a> Working draft</li> <li><a class="external" href="http://www.w3.org/TR/html5/interactive-elements.html#selector-indeterminate" title="http://www.w3.org/TR/html5/interactive-elements.html#selector-indeterminate">HTML 5 Interactive elements #selector-indeterminate</a></li> <li><a class="external" href="http://www.w3.org/TR/html5/forms.html#checkbox-state" title="http://www.w3.org/TR/html5/forms.html#checkbox-state">HTML 5 Forms #checkbox-state</a></li>
</ul>
<h3>See also</h3>
<ul> <li><a class="internal" href="/web-tech/2009/02/05/a-new-checkbox-type" title="web-tech/2009/02/05/a-new-checkbox-type">Web Tech Blog - A new checkbox type</a></li>
</ul>
Revert to this revision