CSS Positioning with Margins
I have my whole site set up to be centered with all elements (position:absolute;) within this one div:
How do I add a <div> with a fixed position (stays in the same left and top position as you scroll down) that will be relative to the centered site?
I tried position:fixed; but it just ignores the margins and a left:60px; is always 60px from the left, no matter how wide the browser window.
It sounds like you should be using
I used "position: absolute" for the elements in the centering <div> so that they would disappear as I scrolled down on the site.
I want a new <div> to be within the centering <div>, but I want it fixed at 60px from the top and 60px from the left of the 960px centering <div> the whole time I scroll down.
I found margin-left:60px works with position:fixed; but I wondered if there was a better way.
If your elements in the centering div aren't scrolling away as one would expect from scrolling — when you are using the default positioning that is — then you must be doing something quite unusual to me.
If you have it working as you want with fixed positioning, then I would say it seems fine to do so. There may be a better way, but using
|All times are GMT +1. The time now is 08:07 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.