CSS’ :empty Selector

One of neat CSS Tricks that qualified as how on earth i just know about this recently is the :empty selector: As the name suggested, it is pseudo selector that selects empty DOM; perfect for hiding empty padding with particular selector that causes unwanted vertical space but somehow we don’t have control over DOM rendering.

I put a simple codepen page to showcase how it works:

See the Pen CSS :empty by Fikri Rasyid (@fikrirasyid) on CodePen.

Leave a Reply

Your email address will not be published. Required fields are marked *