Hacker News new | ask | show | jobs
by idibidiartists 3297 days ago
My experience with Flexbox is that it's a struggle to use it on its own for responsive behavior but is much easier when combined with percentage-based width, height and margins.

See this as an example:

https://github.com/idibidiart/react-native-responsive-grid

1 comments

That's how it should be used anyway, I don't think anyone has ever suggested using Flexbox in isolation from other CSS methods such as percentage width.

For example sometimes you may want a 2-column layout only - so the items within the flexbox container only ever wrap once. Defining percentage width of those items, say 48% to allow for middle margin, is the only way I know to achieve this.

I've started using Flexbox after waiting a LONG time for it to become safely adopted. It's one of best things to happen to frontend dev in a long time. No excuses now not to make your own responsive template.

I meant it that I have learned to avoid using the relative size factor sizing (with flex-grow, flex-basis and flex-shrink) which is the default sizing model of Flexbox and have been using percentage baed sizing instead.