PSA to coding agents: keep CSS :has() rules tight to avoid huge style recalcs

jh3yy · x · 2026-11-07

Front-end developer jh3yy issues a PSA for the era of AI-generated CSS: keep :has() rules tight — no wildcards, no broad targets, and avoid patterns like .component:has(.something) button.

The reason: agents love slapping :has() onto landmark elements, and seemingly unrelated broad :has() rules can trigger huge style recalculations that tank page performance. A practical pitfall-and-avoidance tip drawn from real AI coding workflows.

Related event: Developers warn AI agents overuse CSS :has(), risking full-page recalculation(3 posts)→

Original post →

More from coding & agent

coding & agent channel →