Fixed Positioned Div Inside another Div
Just changed little in George Katsanos code might be helpful for some one.
.outer {
width:200px;
height:300px;
background-color:red;
margin:0 auto;
overflow:auto;
}
.inner {
width:182px;
border:1px solid white;
position:absolute;
background-color:buttonface;
}
Sample at: http://jsfiddle.net/2mYQe/480/
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.
You definitely don't need jQuery or JavaScript to achieve this. This is what you need:
.outer {
width:200px;
height:600px;
background-color:red;
margin:0 auto;
}
.inner {
width:50px;
border:1px solid white;
position:fixed;
}
<div class="outer">
<div class="inner">some text here
</div>
</div>
Have a look at this: http://jsfiddle.net/2mYQe/1/