CSS has evolved a lot in the last few years.

Many things that once needed JavaScript, extra libraries, or messy hacks can now be done with just a few lines of CSS.

In this post, I'll share 24 modern CSS tricks that can help you build cleaner layouts, write less code, and create better user experiences.

Now, let's jump right into it!

1. :has() — The Parent Selector