:empty

The CSS :empty pseudo-class selects any element that does not contain children for a given selector.

/* Changes the background color of every empty section element */
section:empty {
  background-color: tomato;
}

If we were to run that code on …

Avatar of Matt DeCamp
Matt DeCamp on
Keep browsing in the archives