this post was submitted on 11 Aug 2025
566 points (99.5% liked)
Programmer Humor
27490 readers
1434 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why is
.tree's position relative?Needed for the
.leaves’ absolute positioning to be relative to the tree, and not relative to the universe.Damn, I thought you were going to take me out to dinner first
It's so the
position: absolutefor.leavesworks relative to.tree. The implication is that.leavesis a descendant of.tree.position: absolutelooks for the nearest ancestor with a set position in order to determine its own positioning context. Otherwise the absolute positioning would basically be relative to the viewport. If theposition: relativewas missing, the leaves would be against the bottom edge of the image.source
edit: I mean
.leaves, not.branch