T
3
c/css-battle-tacticsval_taylorval_taylor8d agoTop Commenter

Just realized CSS grid can replace 40 lines of float hack I had in production

I was visiting a friend's dev shop in Austin last Saturday and saw one of their juniors rebuild a whole dashboard layout in under 20 lines using subgrid. I had been fighting with nested flex containers and clearfix hacks for months on my own project. Took me about 2 hours last night to refactor my code and now it actually handles responsive breaks without breaking. Has anyone else found a specific subgrid use case that made you ditch float-based layouts for good?
2 comments

Log in to join the discussion

Log In
2 Comments
finleybutler
Tried subgrid on a calendar component last week and it finally fixed those weird alignment gaps that always showed up on mobile. Float layouts would have taken me another month of fiddling with vendor prefixes to match it.
3
alice_barnes35
My buddy in Denver spent a whole weekend fighting with a float-based checkout form that kept breaking on Safari. He switched to subgrid last Tuesday and fixed it in about 15 minutes flat. He said the alignment just snapped into place and he hasn't touched a float since.
3