News for hackers. Stuff that matters.
Re:How to Center in CSS by nkozyra on Sunday April 19, 2015 @08:08PM (#9405432)
Flexbox solves this problem but it's still a bit unwieldy and verbose.
Re:How to Center in CSS by sondr3 on Sunday April 19, 2015 @08:11PM (#9405443)
Verbose? Compared to the other solutions it's a godsend, just use the CSS-tricks guide for it and you'll have nearly zero problems. I absolutely love it and pretty much refuse to use anything else for layout in CSS now.
Re:How to Center in CSS by drcode on Sunday April 19, 2015 @08:34PM (#9405512)
IMHO constraint systems like GSS (http://gridstylesheets.org/) handle centering in a much cleaner way. Pity that approach hasn't gotten any traction (though some people smarter than me say it's a bad idea, so who knows what the right answer is...)
Re:How to Center in CSS by ux-app on Sunday April 19, 2015 @11:16PM (#9405972)
When I first heard of GSS I thought it was the solution to layout that we'd all been waiting for. Unfortunately it's not all roses. It's possible, and quite easy to inadvertently create cyclical constraint dependencies. Depending on how your constraint solver is written this might mean that a layout will fail or that your system will lock or crash.

I'm subscribed to a couple of constraint solver mailing lists. A common question is "why is my constraint solver doing this...?", or "how do I massage my constraints to achieve this...?"

With CSS You can't build a layout that 'fails' (in the sense that a solution cannot be computed due to improperly defined dependencies), and you certainly can't send your browser into an infinite loop by applying an incorrect style.

I still really like the idea of constraint based systems, but I think they are more suited to (web)applications rather than documents.

Re:How to Center in CSS by TeMPOraL on Monday April 20, 2015 @04:48AM (#9406831)
> I still really like the idea of constraint based systems, but I think they are more suited to (web)applications rather than documents.

Which is what some people will tell you web is about when you point out to them they're doing something weird instead of writing a document communicating a message. Maybe it's time to separate those two use cases - web pages and web applications - because otherwise people will keep getting confused between the needs and problems of the two?

Anyway, GSS looks pretty cool.

Re:How to Center in CSS by woah on Sunday April 19, 2015 @10:15PM (#9405797)
I much prefer the deterministic flex box to the mysterious auto layout, even if you might have to use a container div here and there. I think constraint solving is a fascinating idea, but it always seems to end up involving me setting magic priority numbers with little understanding as to why.
Re:How to Center in CSS by look_lookatme on Sunday April 19, 2015 @09:38PM (#9405690)
I agree, flexbox is refreshing. Couple it with autoprefixer or a flexbox scss mixin, layout a design with it for the first time and you won't go back.

For people that are use to hacks + grid systems, it seems weird at first, but over time you will become familiar with a rich layout system and stop thinking left-to-right, it will become more natural. The language of the spec and the declarations (align/justify distinctions, etc) can be weird at first, but you get used to it.

Re:How to Center in CSS by Cub3 on Sunday April 19, 2015 @08:26PM (#9405485)
Just remember IE10 only supports the 2010 flexbox spec (you can't inline-flex, need -ms-prefix etc.)
Re:How to Center in CSS by nkozyra on Sunday April 19, 2015 @08:33PM (#9405511)
Compared to the rest of the CSS spec, I'd say so. It certainly solves the problem much better, though.
Re:How to Center in CSS by mambodog on Sunday April 19, 2015 @08:18PM (#9405459)
Flexbox can be a bit low level, but with it you can build abstractions (eg. classes or preprocessor mixins) for common use cases, which I think is preferable to having only a high-level tool which can't cover all use cases.
Re:How to Center in CSS by cvan on Sunday April 19, 2015 @09:18PM (#9405642)
write using modern/stable flexbox syntax and use autoprefixer for older browsers: https://github.com/postcss/autoprefixer
Re:How to Center in CSS by dominotw on Sunday April 19, 2015 @08:27PM (#9405491)
Verbose?