I need to be able to position fixed element always inside the div.Problem is occuring when I resize the window. Then the fixed div is always floating above all other elements. How to prevent that? I need that div to be fixed but positioned inside the div .Here is an example:\[code\]<div id="main"> <div id="one" style="background-color:yellow;"></div> <div id="two" style="background-color:black;"></div> <div id="three" style="background-color:yellow;"> <div id="four"></div> </div></div>\[/code\]CSS:\[code\]#main{ position:relative; width:1200px; top:0; bottom:0; left:100px;}#one,#two,#three{ position:relative; width:100px; height:1000px; float:left; top:0; bottom:0;}#four{ position:fixed; top:50px; background-color:blue; width:100px; height:200px;}\[/code\]EXAMPLE try moving horizontal scroll left and right and you will see what is happening.