Posted by Ben C on 03/22/07 08:33
On 2007-03-22, Jon Slaughter <Jon_Slaughter@Hotmail.com> wrote:
> In the following test code is it possible to make the first div always align
> itself to the right of the browsers window? I need a simple method because
> the code I'm using it much more complicated. I'm trying to center a table
> that is variable in size that spans the browsers window horizontally but in
> a case where the user scrolls the table does not scroll with it.
> In some
> sense I need the browser to reposition the table when it scrols. (it works
> fine on resize but doesn't work on scroll)
>
> Is there any way to do this with css? What I was trying to do was create a
> table with a column that would vary its width so that it "pushes" the image
> right but I would need to push an amount that equals the number of pixels
> that have been scrolled. This seems impossible though ;/
Use position: fixed instead of float.
div#first
{
position: fixed;
right: 0;
}
That will lock the div to the viewport, and therefore move it relative
to the document when the user scrolls.
[Back to original message]
|