Skip to content
Advertisement

Fixed Positioned Div Inside another Div

I have one div position:fixed; and my problem is that position fixed is relatively to all the page, I need that the fixed div stays inside other div that is centered in the page with margins in auto.(So when I scroll down the page I want to see always the div in the same position).

I use the jquery plugin StickyScroll but I can’t make it work in Internet Explorer.

The solution could be in jquery/javascript , css.

Thanks

Advertisement

Answer

Then you don’t want fixed positioning, but absolute positioning.

Set position: absolute; on the element that you want to position. Set position: relative; on the centered div so that it becomes a layer that you can position elements inside.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement