floating nav to the right with a fixed position?

AMC picture AMC · Feb 21, 2013 · Viewed 57.2k times · Source

My site navigation needs to be floated to the right side of the container, but be in a fixed position so that whenever the page scrolls, the navigation is still on the right 350px from the top. This worked until I applied position:fixed, after doing that the navigation is stuck on the right. Any ideas how I can have the best of both worlds(right side, and fixed position)?

http://jsfiddle.net/eeCgr/

Answer

Brad M picture Brad M · Feb 21, 2013

The usage of position: fixed requires adjusting the top/right/bottom/left CSS to get your nav element to the desired location.

For example:

nav { 
    right: 0; 
    top: 50%; 
}

or

nav {
    right: 0; 
    top: 0;
}