F
17

Appreciation post: finally figured out how to use flexbox without tears

For like 6 months I was just using float and clear for everything in my layouts. Every time I wanted to center something I'd copy paste some old snippet from a project I did in college. It worked but man my code was a mess... always had to add weird margin hacks or set display table. Then last Tuesday I got tired of fighting with a three column layout that kept breaking on mobile. So I spent about 2 hours on flexbox tutorial and it just clicked. Now I can make a row of cards that wrap automatically and center themselves without any of that janky clearfix nonsense. Has anyone else had that moment where you realize you've been doing something the hard way for way too long?
3 comments

Log in to join the discussion

Log In
3 Comments
max223
max2231mo ago
My buddy Dave spent two years manually spacing divs before discovering flexbox.
4
max223
max2231mo ago
Used to think flexbox was overhyped and people just needed to learn proper float behavior. Then I had to build this checkout form that had to look perfect on both desktop and mobile and my god I hit a wall hard. Spent maybe 3 hours trying to get floats to work right and just gave up, learned flexbox that same night. Never looked back honestly, its one of those things where you wonder why you fought it for so long. Your buddy Dave has my full respect for sticking with the manual spacing though, that takes some serious patience
3
amy_west
amy_west1mo ago
Was the same way for years. I kept using tables for layouts because that's what I learned in school and it was comfortable. The breaking point for me was trying to make a navigation bar that would collapse into a hamburger menu on phones. Tables just could not do it without breaking everything. Spent a whole weekend on flexbox and now my nav just works with like 10 lines of CSS. @max223 two years of spacing divs manually sounds brutal but honestly I respect the dedication lol
1