Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Amrit Pandey
17,595 PointsDo I still have to use floats property when I know about flexbox?
I have completed CSS flexbox layout course and I found Flexbox much easy than floats, So i was wondering if we still have to use floats! I also found from caniuse.com that all modern browser uses flexbox.
3 Answers
Terrance Corley
11,990 PointsHi Amrit,
To answer your question I think it's still important to know how floats work. For instance if you wanted your text to float around an image you would still need to use the float property. I myself have shifted for the most part to flexbox for general layout but now I think grid is starting to be used for general layout.
Also, keep in mind browser support for grid is still pretty low so I'd still use flexbox but it wouldn't hurt to get familiar with grid.
Hope this helps.
Nathan Dalbec
17,111 PointsThat all depends on personal preference / company preference, and target audience for your site. If it's something that you are making outside of a company and the people you plan on seeing the site are tech savvy enough to not use an old version of Internet Explorer, then yeah, throw out the floats. According to caniuse, 2.5% of people using the internet are using a browser that doesn't support flexbox, but then again, there are other solutions to replacing float based layouts that doesn't involve flexbox if you care to support that 2.5%.
However, there are still some uses for floats outside of layout, namely to have content flow around an element. Those cases are for the most part few and far between. So overall, floats for layout: out, floats for text to wrap around things: still in
james south
Front End Web Development Techdegree Graduate 33,271 Pointswith the flexbox properties like flex-start and flex-end, i would think the need to float elements would be substantially diminished. i'm implementing flexbox in my current project and have not needed to float anything yet.