Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 338 Bytes

empty.md

File metadata and controls

20 lines (16 loc) · 338 Bytes

CSS selector :empty

If you want to change the style of an element when it is empty, you can use the :empty CSS selector.

<div class="box">Hello World</div>
<div class="box"></div>

<style>
  .box{
    width: 50px;
    height: 50px;
    background-color: pink;
  }

  .box:empty{
    background-color: grey;
  }
</style>