Revision 41273 of :empty

  • Revision slug: CSS/:empty
  • Revision title: :empty
  • Revision id: 41273
  • Created:
  • Creator: brianloveswords
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

{{ CSSRef() }}

Summary

The :empty pseudo-class represents any element that has no children at all. Only element nodes and text (including whitespace) are considered. Comments or processing instructions do not affect whether an element is considered empty or not.

Syntax

span:empty { style properties }

Examples

span:empty::before  { background-color: lime; }

...where...

  <span></span>

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 {{ CompatGeckoDesktop("1") }} 9.0 9.5 3.1
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 2.1 {{ CompatGeckoMobile("1") }} 9.5 10.0 3.1

Revision Source

<p>{{ CSSRef() }}</p>
<h2 name="Summary">Summary</h2>
<p>The<code> :empty </code><a href="/en/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a> represents any element that has no children at all. Only element nodes and text (including whitespace) are considered. Comments or processing instructions do not affect whether an element is considered empty or not.</p>
<h2 name="Syntax">Syntax</h2>
<pre class="eval">span:empty { <em>style properties</em> }
</pre>
<h2 name="Examples">Examples</h2>
<pre class="brush: css">span:empty::before  { background-color: lime; }
</pre>
<p>...where...</p>
<pre class="brush: html">  &lt;span&gt;&lt;/span&gt;
</pre>
<h2 name="Specifications">Specifications</h2>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-selectors/#empty-pseudo" title="http://www.w3.org/TR/css3-selectors/#empty-pseudo">CSS3 Selectors #empty-pseudo</a></li>
</ul>
<h2>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>Basic support</td> <td>1.0</td> <td>{{ CompatGeckoDesktop("1") }}</td> <td>9.0</td> <td>9.5</td> <td>3.1</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>Basic support</td> <td>2.1</td> <td>{{ CompatGeckoMobile("1") }}</td> <td>9.5</td> <td>10.0</td> <td>3.1</td> </tr> </tbody> </table>
</div>
Revert to this revision