Ask HN: CSS – ditch floats and use flexbox?
Hi all
I'm currently creating a website and am wondering what people's thoughts are on adopting flexbox for website layouts.
Flexbox now has good support on modern browsers, but there are still a lot of older browsers in use.
Do you think it's too early to ditch floats for layouts in CSS? Or do you think flexbox is now ready for widespread adoption?
(
6 comments
| 3 points
| on HN
)
Our product is used by their clients. Some of those people are using IE8 and 9. So the approach we take for our product marketing site and the product itself is different.
Flexbox however isn't really designed for full page layout. The UI items it is really great at are often much easier to deal with in terms of legacy support than you entire layout is. You can often use flexbox to enhance a design even if you can't go all in. I would really encourage you to have a look at this video https://www.youtube.com/watch?v=_98SE8WUvLk Zoe works for booking.com and demonstrates how they use flexbox AND ensure legacy support.
.no-flexbox { // fallbacks }
Or you could do the inverse and style with .flexbox { // enhancements } for browsers that support flexbox. Then you can "progressively enhance".
I hate both of the scare quoted terms.
E:
Or if your layout isn't too complex you can use standard fallbacks. Flex rules will be ignored by browsers that don't support them so using Modernizer is a bit overkill.
I'd suggest just using modern CSS.
Depending on whether or not they expect to have users from IE8/IE9 they should degrade/enhance properly to support the maximum amount of users. If they don't expect people to be using IE8/IE9 then just use flexbox.
For basic scenarios you can still get something acceptable for IE8/IE9 with bare minimum work.
My point was "if his target audience uses IE8 they should support IE8". It's a simple question for any dev to ask themselves and it comes with a simple answer.
If you expect to sell anything or provide a service - your competitor that supports IE8 will win a number of your customers over by supporting IE8 better than you do. If you can afford to lose those sales to a competitor, feel free to disregard IE8. (It's often only a negligible amount of sales anyways.)
I don't think anyone supports legacy browsers because they want to.