Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Flexbox Layout Building a Layout with Flexbox Creating a Sticky Footer with Flexbox

Matthew Lang
Matthew Lang
13,471 Points

Does Flexbox make Floats obsolete?

From the looks of it, I have no need to use floats at all anymore. Flexbox just seems like the much more easier, simpler way... I'm sure there are things that specifically require floats, but what are they?

3 Answers

Christopher Debove
PLUS
Christopher Debove
Courses Plus Student 18,371 Points

You can use float for their real purpose. Make an element float on the left or the right (like an image in a newspaper article =)). Using float to align items was not the real purpose of float.

Daniel Tkach
Daniel Tkach
7,607 Points

I'd like to know this as well, I did not understand Christopher's answer.

Matthew Lang
Matthew Lang
13,471 Points

I think I understand now. So, flexbox is all good for layouts etc, however when you have, lets say, a blog post, and you have loads of text and paragraphs etc. Though you want an image also of a product, and you want the text to wrap around the image, well in this case you'd use a float to make the image float to the left/right side, allowing the text to flow around it. Making it all a flex box simply would be too much hassle, and in this case a float would be better.

Sorry if that just confused you even more...

Daniel Tkach
Daniel Tkach
7,607 Points

I think that makes sense Matthew.