tags:

views:

31

answers:

2

Using CSS, how can I position my control so it always appears on the top-right corner of the browser?

+2  A: 

Use absolute positioning and set the top/right attributes.

#control {
    position: absolute;
    right: 0px;
    top: 0px;
}

If you want it to remain on the top right even as you scroll down, you're probably looking at a javascript solution that repositions the element as the page is scrolled.

tvanfosson
A: 

You can use position: fixed to place the content at a fixed location in the viewport. This content will not scroll with the rest of the page. Note that IE6 does not support this CSS setting, so if you need to support that browser, then you are stuck with using JavaScript to achieve the same effect, as already mentioned.

ferdley