T
11

Subgrid finally made me ditch my negative margin habit

Honestly, I avoided subgrid for like a year because I thought it was just a niche trick that would break in older browsers. Then last week I redesigned a product listing page with nested cards, each one had an image, a title, and a price that needed to line up across rows. My old approach was pixel padding and negative margins, and it looked fine until one title wrapped to three lines and threw everything off. I switched the inner grid to subgrid for the row heights and suddenly the alignment just clicked, no magic numbers, no media query hacks. Took me maybe 45 minutes to refactor what I'd been fighting for months. Has anyone else been sleeping on subgrid and then found it solves those weird alignment headaches with nested components?
0 comments

Log in to join the discussion

Log In
0 Comments

No comments yet

Be the first to share your thoughts on this discussion.