The Best Styling Is the One You Can Remove Later
Maintainable design systems prioritize deletion over addition. CSS should be as disposable as the features it styles.
The Accumulation Problem
CSS has a unique property: it's easier to add than to remove. Over time, stylesheets become archaeological sites:
Designing for Deletion
The best CSS is written with its eventual removal in mind:
1. Scope Everything
Instead of global styles, use scoped selectors that are easy to identify and remove.
2. Avoid Deep Nesting
Shallow, specific selectors are easier to override and remove than deeply nested ones.
3. Use Utility Classes Sparingly
Component-based styles with utilities for spacing work better than utility-heavy markup.
The Component Lifecycle
Every CSS rule should have a clear lifecycle:
2. Growth: Extended and refined as needed
3. Maturity: Stable and well-understood
4. Death: Removed when the component is deprecated
Strategies for Removable CSS
1. Co-location
Keep styles close to the components they style.
2. Explicit Dependencies
Make it clear what styles depend on what.
3. Automated Cleanup
Use tools to find unused styles:
4. Documentation
Document the purpose and dependencies of your styles.
The Refactoring Test
Good CSS passes the refactoring test:
Framework Considerations
Different approaches to removable CSS:
CSS Modules
CSS-in-JS
Utility-First (Tailwind)
Traditional CSS
Practical Guidelines
2. Avoid !important - it makes removal risky
3. Use CSS custom properties - easier to change values later
4. Keep specificity low - easier to override and remove
5. Regular CSS audits - schedule time to remove unused styles
The Business Case
Removable CSS saves money:
Conclusion
The best CSS is not the cleverest CSS—it's the CSS that doesn't get in your way when you need to change or remove it.
Write CSS like you're writing code that someone else will need to delete. Because they will.