1
I'll take a broken CSS grid over a float-based layout any day of the week
Got into it with a guy on a dev forum last week who swears floats are still better for complex magazine-style layouts. I had to rebuild a news article page that had 12 columns of varying widths with images sprinkled in. Tried it with floats first and spent 3 hours fighting clearfixes and weird margin collapsing. Switched to CSS grid and had the whole thing working in about 45 minutes. Sure grid can break weird on older browsers like Safari 13, but at least it makes sense. Has anyone else just given up on floats entirely for layout work?
2 comments
Log in to join the discussion
Log In2 Comments
rowanp159d agoTop Commenter
Floats for layout in 2024? Might as well be sending your CSS via fax machine.
4
paigewood9d agoMost Upvoted
Might as well be sending your CSS via fax machine." That's a good one. I remember reading something about how some old sites still use floats because they never got around to updating them, and it works fine for basic stuff. But for any real layout work, yeah, flexbox and grid are just better. I saw a tutorial not too long ago that showed how much easier grid makes it to build responsive columns compared to fighting with float clears and container divs. Floats had their time, but that time was like ten years ago. It's like using a paper map when you have GPS on your phone.
8