How to structure your CSS utility classes to avoid specificity wars

by•

When a style sheet grows a product team can find many rules that clash and many overrides that happen by accident. I saw this problem every day. We fought a battle of specificity that seemed never to end. Then we decided to use a naming system that focuses on what the layout component does instead of on the specific HTML tag. After we cleaned up our styles our component updates became predictable. The size of our CSS bundle also dropped a lot. Using the naming rules has saved us many hours of fixing layout bugs. How do you keep styling rules tidy when your team grows?

1 view

Add a comment

Replies

Be the first to reply

Have a question or a thought to share? Add a comment above to start the conversation.