Say I have an absolutely positioned div inside a normal one.
<div id="wrap"> <div id="sidebar"></div> </div>
In this case, when I state top
and left
for the "sidebar", they are calculated inside of the "wrap", because the latter is position="relative"
.
However, when I change the "sidebar" to position="fixed"
, the coordinates are calculated relative to the <body>
, not the "wrap", which results in "sidebar" jumping out of its parent, even though the coordinates stay the same.
How do I make the "sidebar" to stay inside the "wrap", yet be fixed?
Thanks.