can't believe i can't do this simply CSS. fixed div but not to window but within div

Joined
12 Feb 2006
Posts
17,367
Location
Surrey
simply want a div to be fixed to the top left of the content so that it floats always on the screen even when scrolled down it'll still be there. i can get it to be fixed on the window so it'll be top left no matter the width, but what i want is it to be within a container that's 700px wide, so it'll be to the left of that and if the page is very wide then it's not lost to the left.

any clues. absolute doesn't work either as that'll not scroll down the page with you.
 
thanks guys. got it in the end by simply taking away the left: 0; style.

this is simply what i have

#header {
width: 303px;
height: 400px;
position: fixed;
top: 20px;
border-right: 1px solid #de200f;
text-align: right;
}

and it now stays to the left of the container, and the top of the page even when scrolling. voila
 
Last edited:
Back
Top Bottom