Today I Learned

Avoid unnecessary CSS nesting

March 06, 2022

Why?

The more selector we include in styling the element, the higher the CSS-specificity will be, and it’s harder to override in the future.

So when you’re styling your code, if it’s not a must, just keep your css nesting as light as possible so later you don’t have to use !important everywhere.


© 2025 - Written by Vuong Vu. Connect with me on LinkedIn.