DEV Community

Discussion on: CSS :empty Selector

Collapse
 
okumurakengo profile image
奥村健吾 • Edited

I did not know. Thank you very much !

also :not and :empty can be used to hide empty state 😀

<style>
.alert:not(:empty) {
  background: pink;
  padding: 10px;
}
</style>
<div class="alert"></div>
<div class="alert">Alert Message</div>

Thanks!
 

Collapse
 
samanthaming profile image
Samantha Ming

Nice! that's an awesome application of it 👍