Usually, an absolutely positioned element (position:absolute
) is placed relatively to its closest positioned ancestor.
Now, I want to place that element relatively to its direct parent.
What I could obviously do, is:
- taking the parent
- checking whether it is already positioned
- if not, adding position: relative to it
- proceeding in positioning the element
I am pretty sure there must be a simpler solution, any ideas?