T
24

Spent 4 hours trying to center a div with CSS Grid before I realized grid items have their own alignment properties

2 comments

Log in to join the discussion

Log In
2 Comments
alice_barnes35
Four hours is a lot. But I also spent a solid 90 minutes once trying to get a flex container to stop squishing my buttons before I realized I forgot to set flex-shrink to 0. You learn these things once and then you never forget them. The guy who said grid items don't align unless you set the parent first is technically correct, but its also just another line in a long list of CSS gotchas. Honestly, if you didnt break anything else while figuring it out, you came out ahead. Most people would have rage quit after hour two.
5
the_leo
the_leo3d ago
Close, grid items don't have their own alignment unless you set them on the parent first.
3