mozilla

Revision 239677 of :indeterminate

  • Revision slug: CSS/:indeterminate
  • Revision title: :indeterminate
  • Revision id: 239677
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The :indeterminate CSS pseudo-class represents any <input type="checkbox"> element 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> 

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
type="checkbox" {{ 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
type="checkbox" {{ CompatUnknown() }} {{ CompatGeckoMobile("1.9.2") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
{{ HTMLElement("progress") }} {{ CompatUnknown() }} {{ CompatGeckoDesktop("6.0") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>:indeterminate</code> CSS <a href="/en/CSS/Pseudo-classes" title="en/CSS/Pseudo-classes">pseudo-class</a> represents any<code> &lt;input type="checkbox"&gt; </code>element 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>
<h2 id="Examples">Examples</h2>
<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 class="brush: css">&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>
<h2 id="Specifications">Specifications</h2>
<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>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<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><code><span>type="checkbox"</span></code></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><code><span>type="checkbox"</span></code></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>
<h2 id="See_also">See also</h2>
<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