Streaming live at 10am (PST)

How do I influnce what my object is relative to?

How do I influnce what my object is relative to? No matter what I do, this little fella allway says “body”

Though my div is nested 3 levels deep.

How is this supposed to work?

Ok, so I solved it. The parent object must have some other positioning then “auto” enabled.


OK, so, the best rule in CSS:

Objects are positioned regarding their closest positioned parent.

Every word is important :smile:

And luckily, we have the position:relative to play with. So, if you want B to be relative to A, give A position:relative so it’s positioned, and B relative + coordinates or absolute + coordinates. Relative with nothing else doesn’t have any effect on object. Be sure that no other object is positioned between what you want to position and the reference parent.

I’m going to start making teeshirts with this rule I think :slight_smile:


ah we posted at the same time :slight_smile:

Thanks though, good answer. I might be interested in one of those shirts. :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.