Architecture Decision Records (ADRs)

← Home

Minimize :not() CSS pseudo-class usage

Introduction

Overuse of the :not() selector may cause specificity issues and, is harder to understand what is going on in the code.

Decision

Avoid using the :not() pseudo-class selector in CSS whenever possible, opting for more specific and direct selectors instead.

Context

The :not() selector often leads to complex and hard-to-maintain stylesheets with specificity issues if overly used or not scoped properly.

Consequences

Exceptions

Additional Resources

← See more ADRs