Re:Media Queries are a Hack
by ianstormtaylor on Thursday April 04, 2013 @07:05PM
(#5495874)
Very cool repo and articles that he links to. Lots of the layout constraints (not type-size, colors, etc.) should be solved when Flexbox support lands in the other major browsers. For example a 20% wide container, that gets no wider than 800px and no skinnier than 200px can be solved with Flexbox pretty easily.
Not having adequate Flexbox support after it being discussed for soooo long is my other big problem with CSS.
flexbox is great, but it only solves a narrow set of layout issues. There's so much more that a constraint based system brings to the table. A layout system should make it extremely simple to anchor edges between arbitrary containers regardless of their position in the DOM.
While we're at it lets scrap the DOM too. It's really painful to see how much it is being contorted to suit the application paradigm.
Though obvious, FWIW: correct link to [1] https://github.com/slightlyoff/cassowary-js-refactor
In regard to your layout in JS question. There is an excellent port of the Cassowary constraint solver in JS [1]. It allows you to specify complex relationships between containers along with weights, which allow you to specify layouts in a sane manner. Performance is very good, especially since it takes advantage of web workers where available.
What I hate most about layout in CSS is that it takes something that should be brain-dead simple and turns it into something that requires memorization of edge cases and browser hacks with some added voodoo magic. It's such a waste of brain cycles.
To top it all off constraint based solvers have been around for over 20 years... and yet in 2013 we're still dealing with this mess.
[1] https://github.com/slightlyoff/cassowary-js-refactor