I have a page with dynamic content that often causes the page to grow taller and wider than the height and width of the browser window. When this happens, vertical and horizontal scroll bars appear.
I also have an 800 pixel wide div on this page, top and center. I would like for the div to always remain horizontally centered, regardless of horizontal scrolling, but to move up and down with the rest of the page when scrolling vertically.
I asked this exact question here a few hours ago, and a very bright and thoughtful person gave me what I thought was the answer. Unfortunately, it turned out that this solution works in Firefox and Safari but not in IE7. I'm posting the JavaScript I'm referring to below in case anyone knows of a way to modify it so that it would work in IE. This script works when the div id is "test001" and has the following CSS style attributes: "width: 800px; margin: auto;"
Thanks.
Start Free Trial