5 ms·
IMO not worth it for the loss of compatibility, since flexbox is just as easy.
by asddubs 6y ago
IMO not worth it for the loss of compatibility, since flexbox is just as easy.
- runarberg 6y agoIE compatibility is increasingly rare. Grid is supported by 95% of all browsers globally. If your target group is any narrower, or if centering the content doesn’t break the page and you aren’t shy of serving a weird looking layout to people with old browsers, there is no reason not to use grid.
- asddubs 6y agothere is no reason not to use flexbox if all you want to do is center something. and that sentence doesn't even need any additional qualifiers.
- joshspankit 6y agoGrid is way better than flexbox. All hail CSS-Grid.
- perardi 6y agoGot a citation for this? I’ve seen this said, and for the life of me, I can’t find an actual reference for it.
- joshspankit 6y agoCitation: Purely subjective personal experience / opinion. At least it’s first-hand.
- eyelidlessness 6y agoThey have many overlapping capabilities, but there are things flexbox can do which grid cannot. For instance, flexbox can wrap with dynamically sized children.
- jonny_eh 6y agoAlso harder to learn.
- have_faith 6y agoThey solve different problems.
- runarberg 6y agoIn general: Flex is for flowing content, grid is for structured. You can do some awesome wrapping with flex that is impossible with grid. Also `margin-inline-start: auto` is pretty rad using flex, although you can do something similar with `justify-self` with grid. A good use case for flex would be a list of tags, that need to wrap.
- sodapopcan 6y agoGrid is not a replacement for Flexbox, it compliments it. Flexbox excels when you are only concerned with one dimension, grid excels when you're concerned with two (ie, a grid!) And yes, there is overlap.
- soperj 6y agoWhat browser are you even worried about at this point? IE isn't even supported by microsoft any more.
- yakshaving_jgt 6y agoThat is not true[0]. [0]: https://death-to-ie11.com/ https://death-to-ie11.com/
- soperj 6y agoIt is in the sense that they produce websites that no longer work properly with IE.
- perardi 6y agoGrid has extremely broad support. https://caniuse.com/css-grid https://caniuse.com/css-grid The notable exception is IE 11…though even then, with a bit of autoprefixer magic, you may be able to use this.
- asddubs 6y agoor you could just use flexbox to do the exact same thing and have a superset of that extremely broad support, including ie11 without having to rely on any kind of magic. https://caniuse.com/flexbox https://caniuse.com/flexbox I do use grid when I need it, but I don't see the point of using grid in places where flexbox will do. Granted this is on the verge of not mattering at all anymore, but I just don't see the point in using something less compatible when you don't have to.
- schwartzworld 6y agoI want to learn grid, and I keep waiting to be given a layout I can't implement in flexbox as an excuse. It's been years of waiting through multiple jobs.
- sodapopcan 6y agoI like grid because it eliminates the need for any elements that exist purely for layout. This makes markup cleaner which makes it easier to change in the future. But as I stated in elsewhere in this thread, grid is not a replacement for flexbox. There is overlap, they both have their strengths.
- asddubs 6y agothe one thing i couldn't do with flexbox where I had to use grid was a sidebar that was being rearranged responsively, part of it below the main content, and part of it above. but yeah, most of the time flexbox + order can get you quite far
- Zardoz84 6y agoAn acceptable subset of CSS Grid works on IE11. And if you use autoprefixer, 99% of the time would work out of the box.