Forum Moderators: not2easy

Message Too Old, No Replies

position:fixed inside overflow:auto

Judging from the specs this isn't happening

         

Robin_reala

9:28 am on Aug 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

another Monday morning challenge :) Today I've got a container with a fixed height and width, and overflow auto. Inside this container I've got a link that I always want at the top-right regardless of what the container's scroll position is. The container is absolutely positioned and could feasibly be at any place on the page. So my question is: Is there any way to achieve this layout without Javascript?

The major problem I suppose is that position:fixed always positions according to the viewport, not to the nearest positioned ancestor.

Drag_Racer

2:00 pm on Aug 21, 2007 (gmt 0)

10+ Year Member



what I would do is add a div inside your container to hold the link, then add another div in your container to hold the rest of the content. The second div will have the scroll and not your container.

Robin_reala

6:09 pm on Aug 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Good plan! Don't know why I didn't think of that before, but that'll work. Thanks :)