this post was submitted on 11 Aug 2025
561 points (99.5% liked)

Programmer Humor

25917 readers
1299 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

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] yetAnotherUser@lemmy.ca 7 points 1 week ago (2 children)

Why is .tree's position relative?

[–] bleistift2@sopuli.xyz 31 points 1 week ago (1 children)

Needed for the .leaves’ absolute positioning to be relative to the tree, and not relative to the universe.

[–] hemmes@lemmy.world 9 points 1 week ago

Damn, I thought you were going to take me out to dinner first

[–] BleakBluets@lemmy.world 6 points 1 week ago* (last edited 1 week ago)

It's so the position: absolute for .leaves works relative to .tree. The implication is that .leaves is a descendant of .tree.

position: absolute looks 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 the position: relative was missing, the leaves would be against the bottom edge of the image.

source

edit: I mean .leaves, not .branch