• bleistift2@sopuli.xyzOP
      link
      fedilink
      English
      arrow-up
      27
      ·
      17 days ago

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

    • BleakBluets@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      1
      ·
      edit-2
      17 days 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

  • JasonMcCrea@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    16 days ago

    Saw this post about “CSS Gardening,” and I’m reminded of debugging my first responsive website. Did anyone else spend hours wrestling with margins and padding, only to realize it was a typo in the media query? I did! Now I meticulously check my syntax.