treehouse : what would you like to learn today?
Web Design Web Development iOS Development

'MAIN BODY' Moves on navigation button press

  • Hey everyone I've got a simple problem that I can not figure out. :oops:

    When I navigate to any page within my site the whole 'BODY' jumps to the left 5 pixels or so. What would be the reason behind this and the fix?

    My site pages are fixed at 960px wide and any time I navigate to a longer page the whole 'BODY' moves just enough to annoy...

    Full XHTML and Strict CSS no tables!

    If you have any feedback i would appreciate it! Thanks :D
  • This is caused by the scrollbar appearing when your page is longer than the window.

    You can either set the height of the html tag to 101% so the scrollbar is always there or do this.

    html {
    overflow-y: scroll;
    }


    The later won't validate unless you inject it dynamically with something like jQuery.

    Should sort it out.
  • That's perfect! :idea:

    For some reason I never accounted for the scroll bar but assumed there had to be a fix.

    Thanks for your help!
  • I have to express my thanks again, It was so simple but did not know where to look.

    Im a free man again!