Not sure how to make amends. I have such an html structure:
<div id="nav"></div> <div id="wrapper"> <div id="content"> </div> </div>
With some css like this:
#nav { width: 200px; height: 50px; margin: 0 0 0 -100px; position: fixed; left: 50%; background: red; } #wrapper { width: 250px; height: 1000px; margin: 0 auto; background: blue; } #content { width: 200px; height: 1000px; margin: 0 auto; background: green; }
The wrapper is wider than the content, and the content is concentrated in the shell. My problem is to keep the div div that is attached to the top of the page centered / aligned with the contents of the div when the window is smaller than the wrapper of the div. Problems arise when scrolling left and right, a fixed div remains centered in the window, and the contents of the div scroll left and right. I am trying to execute this without javascript.
Here, the jsfiddle of what I run resizes the results window to see how the nav div will not center / align with the contents of the div when the window is smaller than the wrapper of the div.
http://jsfiddle.net/p2Mzx/1/
Thanks in advance!
source share