PDA

View Full Version : CSS fixed position question


DWcourse
11-30-2009, 07:47 PM
From my understanding the position:fixed property isn't supposed to work like this but it does for Safari, FF and IE greater than 6.

I have a 3-col (divs) centered layout. If I set the the style rule for the left sidebar to position:fixed (with no other positioning information), the column appears in the proper location and does not scroll vertically however it does reposition itself when the window is resized to stay in the proper location within the design. (In other words the div appears within the flow of the layout, it just doesn't scroll away).

There's a a sample at http://student.dominatedreamweaver.com/

That's how I want it to work but it's not how I read the rules for fixed positioning. Am I missing something?

Corrosive
12-01-2009, 06:25 AM
I don't think I'd expect it to stay pinned to the left because it is in your container div. It would remain fixed to the edge of that so it would shift with the rest of the site when the browser window is re-sized. As you say. It remain fixed when you scroll vertically.

Only one way to find out. Try putting the sidebar outside of the container and see what you get :)

domedia
12-01-2009, 01:59 PM
It's positioned absolute, relative to it's parent element.
Exactly how it is supposed to work.

It's acting so because the parent element has position: relative. Remove it and you'll see the column being absolutely positioned based off the top left corner of the viewport instead.