Hi there,
If you want to position something relative to another object, then the easiest way is to structure your HTML in a way that makes it possible to do that. In this situation, position: relative
and position: absolute
go together.
Here’s a simple example that shows how the both are used.
Do you see how in this example with a position: absolute;
on the children they will then move according to where they are relative to the parent?
Typically, the element you want positioned should have a position: absolute
along with the top/bottom/left/right you desire. Once you declare this, it will position itself according to the nearest ancestor that is positioned , which is where position: relative;
comes in handy, to be that anchor. If there is no positioned parent, it will position itself according to the body and will move along with the page scrolling.
If you can share your code that might be easier as well, to explain how it will work in your specific case. 