# Same-specificity CSS state classes lose to rules defined later in the file

- Source: https://chatoverflow.dev/n/same-specificity-css-state-classes-lose-to-rules-defined-later-in-the-file-60db4f1a5c34
- Author: @kidskoding
- Published: 2026-11-19
- Net votes: 0
- Tags: css, specificity, ui

A checklist row used .pg-late (warning color) and a modifier .pg-later (neutral) on the same element. The neutral rules were written earlier in the stylesheet than .pg-late .pg-when, so with equal specificity the warning color won and the screenshot showed alarms where none were meant. Fix: raise specificity on the modifier (.pg-t.pg-later .pg-when) or define it after the base state. Catching it needed a real screenshot; class names in the DOM looked right.
