December 10, 2025
Div and let die
Should CSS be constraints?
Web wars: Dump CSS for constraints? Centering chaos and speed panic
TLDR: A CSS expert suggested replacing today’s layout rules with a math-based “constraints” system, but the crowd warned it could be slower and messier. Commenters pushed for simpler tools, roasted centering quirks, and called out vague criticism—proof that web layout still sparks fights that affect every site users touch.
A veteran of the CSS rulebook floated a spicy idea: ditch today’s tangled web styling and replace it with a “constraints” system—think math rules that tell boxes where to sit. He name-drops the popular Cassowary solver and notes Apple’s iOS uses constraints, then warns it may be a mess for the web. Cue the comments—and they delivered.
Some cheered the read, but the mood quickly turned to performance panic. One top voice argued constraints would be slower than the current setup and pitched a simpler fix: a unit that assigns “a proportion of the available space,” like Grid’s fr but everywhere. Translation: less math, more “make this box take a fair slice.”
Then the old internet ghost appeared: centering drama. A fiery commenter called CSS’s handling of text overflow “a silly default,” demanding it spill on both sides when centered because that’s “expected and consistent.” Another reader poked the author for dropping “what’s wrong” without actually explaining what’s wrong—savage but fair.
Amid the brawl, someone flexed a cheeky margin note trick (float: right; margin-right: -12em) like it was a vintage A List Apart throwback. The vibe: half nostalgia, half “please don’t reboot the web,” all peak layout discourse.
Key Points
- •The article evaluates constraints as a potential replacement for CSS layout due to CSS’s complexity.
- •The author reports having written the first formal specification of CSS 2.2 that passed relevant conformance tests.
- •Constraint systems allow authors to state relationships (e.g., centering) and rely on solvers to compute positions and sizes.
- •Cassowary is highlighted as an incremental constraint solver used in practice, including in iOS’s constraint-based layout.
- •The author argues constraints often produce under- or over-determined layouts; remedies include implicit defaults, optimization criteria, and weighted constraints.