1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
8 <style type='text/css'
>
11 body
{ background: #fff; color: 000; font-family: Arial
, Helvetica
, sans-serif
; }
12 pre
{ background: #fff; padding: 0.5em; }
13 li
{ background: #aaa; padding: 1em; width: 80%; margin: 0 0 3em; }
14 .test { display: block
; padding: 0.75em; }
15 .base, .defaultgreen { background-color: #090; }
16 .defaultred { background-color: #900; }
19 background-color: #090;
22 .defaultgreen :empty {
23 background-color: #900;
35 <p>This page is part of the
<a href=
"http://www.css3.info">CSS3.info
</a> <a href=
"http://www.css3.info/selectors-test/">CSS selectors test
</a>. See more info on
<a href=
"http://www.css3.info/preview/attribute-selectors.html">CSS3 selectors
</a>.
</p>
37 <div class='base'
></div>
42 <div class='defaultred'
>
43 <div class='test required'
></div>
49 <div
></div
></pre>
52 The CSS selector should match the div element, because it is empty
57 <div class='defaultred'
>
58 <div class='test'
><!-- Just a comment --></div>
64 <div
><!-- Just a comment --
></div
></pre>
67 The CSS selector should match the div element, because it is empty
72 <div class='defaultgreen'
>
73 <div class='test default'
> </div>
79 <div
> </div
></pre>
82 The CSS selector should not match the div element, because it is not empty
87 <div class='defaultgreen'
>
88 <div class='test default'
>
97 How about regular text...
101 The CSS selector should not match the div element, because it is not empty
106 <div class='defaultgreen'
>
107 <div class='test default required'
><blockquote></blockquote></div>
113 <div
><blockquote
></blockquote
></div
></pre>
116 The CSS selector should not match the div element, because it is not empty
121 <div class='defaultgreen'
>
122 <div id='appendChild' class='test default'
></div>
125 <script type=
"text/javascript">
128 var ib
= document
.getElementById('appendChild');
129 ib
.appendChild(document
.createElement("div"));
137 <div id='appendChild'
></div
>
139 var ib = document.getElementById('appendChild');
140 ib.appendChild(document.createElement(
"div"));
</pre>
143 The CSS selector should not match the orignal div element, because it will not be empty
144 anymore after the Javascript code appends a child element to it.