December 7, 2025
Center this chaos
Should CSS be a constraint system instead?
Web devs brawl over ditching CSS for 'magic math' layouts
TLDR: The article floats swapping CSS rules for constraint equations. Commenters slam that as slow and brittle, argue for better sizing units and device-friendly priorities, while some share minimalist CSS patterns; it matters because layout choices shape performance and readability across the entire web.
Another day, another internet cage match: should we toss CSS and replace it with a system of constraints—basically telling boxes to sit here, grow there, and center themselves by math? The article argues constraints sound elegant but quickly become “under- or over-determined,” i.e., too few rules or too many. Cue the comment section going full reality TV.
The loudest chorus? Performance panic. nicoburns warns constraint solvers would chug like an old laptop, and instead begs for a simple “proportion of space” unit everywhere—think an easy slider for size. Meanwhile, troupo drags the status quo, saying CSS made text overflow weird on purpose; if your centered text doesn’t fit, “spill on both sides” is the only sane behavior. Rendaw calls out the piece for hand-wavy fear: “you say constraints are bad, but where’s the actual ‘wrong’?”—translation: show receipts.
Then comes the big-picture crowd. Lerc says CSS is serving too many masters and dreams of “priority regions” where devices can choose what matters most on small screens. And adityaathalye flexes a zen approach: treat CSS like a light constraint system using a few simple patterns—the center, stack, box, cluster—in ~50 lines, tipping every-layout.dev. The memes? Endless “just center the div” jokes, Cassowary solver quips (“bird solves layout better than me”), and a split between Team Math Magic vs Team Keep It Simple. Drama centered, finally.
Key Points
- •The article evaluates replacing CSS with constraint-based layout systems and explains how constraints specify relationships between elements.
- •A referenced paper proposes “Constraint Cascading Style Sheets,” where browsers solve layout constraints authored by developers.
- •Cassowary, an incremental constraint solver associated with Alan Borning, supports fast updates and underpins iOS’s constraint-based UI layout.
- •Constraint systems can produce under- or over-determined layouts, requiring additional defaults, optimization criteria, or weighted constraints.
- •The author argues these complexities make constraints challenging as a wholesale replacement for CSS’s rule-based approach.