29
Finally got my first CSS grid layout to work after 4 tries
I spent maybe 3 hours last night fighting with CSS grid to make a simple 3-column layout for my practice site. Kept getting weird gaps and items stacking on top of each other. Turns out I was missing a closing div tag the whole time, which was making the grid act crazy. Has anyone else spent way too long debugging something that ended up being a stupid typo?
2 comments
Log in to join the discussion
Log In2 Comments
claire_campbell1mo ago
The missing closing div is a classic gotcha. One thing to double check is that your grid items themselves don't have margins or padding set on them that mess with the spacing. Usually a `grid-gap` property is enough for the gaps, no extra margins needed on the items themselves. Did you figure out the trick with `fr` units for column sizing yet?
9
cora56229d ago
Ugh, the margins on grid items thing tripped me up for days. It's such a simple fix but drives you crazy finding it.
5