blob: ed47ba891a4b9e9b2090ba7db5e53af3aa5e07c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
title: ':empty'
slug: 'Web/CSS/:empty'
tags:
- CSS
- CSS Pseudoklasse
- Layout
- Referenz
- Web
translation_of: 'Web/CSS/:empty'
---
<div>{{CSSRef}}</div>
<h2 id="Übersicht">Übersicht</h2>
<p>Der pseudo-Klassen Selektor <code>:empty</code> wählt Elemente aus, die über kein Kindelement verfügen. Ein Inhalt in Form von einem Text wird dabei ebenfalls als ein Kind des Elementes angesehen, Kommentare und sonstige Verarbeitungsanweisungen jedoch nicht.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><element>:empty { /* Deklarationsblock */ }
</pre>
<h2 id="Beispiele">Beispiele</h2>
<pre class="brush:css">span:empty::before {
background-color: lime;
}
</pre>
<p>Die ersten beiden <code>span</code> Elemente sind leer, sodass der <code>:empty</code> Selektor angewendet wird. Auf die letzten drei trifft das jedoch nicht zu.</p>
<pre class="brush:css"><span></span>
<span><!-- Dieses Element wird grün dargestellt --></span>
<span> </span>
<span>Lorem ipsum</span>
<span><strong></strong></span>
</pre>
<h2 id="Spezifikationen">Spezifikationen</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Spezifikation</th>
<th scope="col">Status</th>
<th scope="col">Kommentar</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS4 Selectors', '#empty-pseudo', ':empty')}}</td>
<td>{{Spec2('CSS4 Selectors')}}</td>
<td>Keine Änderung</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Selectors', '#empty-pseudo', ':empty')}}</td>
<td>{{Spec2('CSS3 Selectors')}}</td>
<td>Ursprüngliche Definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_Kompatibilität">Browser Kompatibilität</h2>
{{Compat("css.selectors.empty")}}
|