/* Background color of every empty div element */
div:empty {
  background-color: #000;
}
<div>
  <p>Some text</p>
</div>
<div>
  <!-- No text, background #000 -->
</div>