10
Saw a huge difference when I swapped from absolute to grid for a mountain scene
I was messing around with a pure CSS landscape of some mountains last week and it looked all janky. Layers kept overlapping wrong and I couldn't get the sun to stay behind the peaks no matter what z-index I tried. So I decided to try CSS grid instead of using absolute positioning for everything. I set up a single grid container with the sun and three mountain peaks as grid items overlapping the same area. The difference was night and day. Suddenly everything snapped into place without fighting with positions or stacking orders. Took maybe 30 minutes to recode what I'd spent 2 hours failing at before. Has anyone else had better luck with grid for layered artwork compared to absolute?
2 comments
Log in to join the discussion
Log In2 Comments
emma_ramirez1d ago
Grid saved my sanity with overlapping elements too. Absolute positioning is so finicky.
-1
the_ray21h ago
Man I don't know, I've been using absolute positioning for years and never lost any sleep over it. Feels like people just want something new to get excited about.
7