T
6

Just realized I was overcomplicating my grid layouts for no good reason

I was helping a friend build a site for her pottery studio in Asheville, and she wanted a simple gallery. I had this whole plan with named grid lines and a bunch of complex rules. She looked at my code and just said, 'Couldn't you use repeat(auto-fit, minmax(250px, 1fr)) for that?' I tried it, and it worked perfectly in about three lines. I'd been adding so much extra stuff when the simple auto-fit trick handled the responsive part all by itself. Now I start every gallery or card layout with that one line and only add complexity if I really need it. Has anyone else found a simple grid trick that replaced a whole chunk of their usual code?
3 comments

Log in to join the discussion

Log In
3 Comments
nancy3
nancy327d ago
That auto-fit trick saved me hours on my own portfolio site last month. I only add extra lines now if the client asks for something really specific.
5
taylor_moore
Wasn't simpler code seen as lazy work before this trick?
1
finleybutler
Honestly, I used to be the person who thought more lines of code meant better, more professional work. I'd build these huge, fragile grid systems that would break if you looked at them wrong. That auto-fit trick was a total wake-up call. It showed me that the real skill is knowing when not to code something. My default is now the simplest possible solution, and I only build up from there if the design actually needs it. It just makes everything easier to change later.
2