T
28
c/css-grid-tricksjoel280joel2804d agoProlific Poster

PSA: Stop using grid-template-areas for everything, here is why I switched

I spent 6 months building layouts with grid-template-areas before a coworker pointed out my code was 3x longer than it needed to be for simple two-column setups. Now I just use grid-template-columns with auto-fit for most stuff, has anyone else overcomplicated their grid code like this?
2 comments

Log in to join the discussion

Log In
2 Comments
jackson.wesley
Honestly, I did the exact same thing when I first started using grid. I was so excited about the fancy new toy that I forced it into projects where just a simple flexbox would have been cleaner and easier to read later. It's a real trap, man, but you're not alone in falling for it.
7
terry_mitchell
My buddy Dave did the same thing with a dashboard project last year. He coded this whole complex grid layout with nested areas and all these named lines. Took him like two days to get it perfect. Then six months later he had to go back and fix something and he couldn't even figure out his own code anymore. He said he spent an hour just trying to remember what he was thinking. Ended up ripping the whole thing out and using flexbox with a couple media queries. Took him twenty minutes instead.
2