We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

This translation is incomplete. Please help translate this article from English.

La pseudo-class CSS :empty representa qualsevol element que no tingui fills. Els fills poden ser nodes d'elements o text (inclosos els espais en blanc). Els comentaris o les instruccions de processament no afecten si un element es considera buit o no.

/* Selecciona qualsevol <div> que no contingui cap contingut */
div:empty {
  background: lime;





<div class="box"><!-- I will be lime. --></div>
<div class="box">I will be pink.</div>
<div class="box">
    <!-- I will be pink because of the whitespace around this comment. -->


.box {
  background: pink;
  height: 80px;
  width: 80px;

.box:empty {
  background: lime;



Especificació Estat Comentari
Selectors Level 4
The definition of ':empty' in that specification.
Working Draft Sense canvis
Selectors Level 3
The definition of ':empty' in that specification.
Recommendation Definició inicial

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Descripció Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic 1.0 (Yes) 1.0 (1.7 or earlier) 9.0 9.5 3.1
Descripció Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic 2.1 (Yes) 1.0 (1) 9.5 10.0 3.1

Document Tags and Contributors

 Contributors to this page: Legioinvicta
 Last updated by: Legioinvicta,