I run into situation that when user scroll down, a part of the sidebar gets fixed position, however when I catch the position and apply fixed css to the sidebar element, it gets fixed to whole screen, not just the parent (which is sidebar)
how do I setup this correctly?
First Understand Positioning:
So in your case your parent
divshould haveposition:relativeand your childdivshould haveposition:absoluteinstead ofposition:fixedReference Link