Grow your CSS skills. Land your dream job.

‘MAIN BODY’ Moves on navigation button press

  • # November 13, 2008 at 12:48 am

    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

    # November 13, 2008 at 10:23 am

    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.

    Code:
    html {
    overflow-y: scroll;
    }

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

    Should sort it out.

    # November 13, 2008 at 12:14 pm

    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!

    # November 13, 2008 at 12:24 pm

    I have to express my thanks again, It was so simple but did not know where to look.

    Im a free man again!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".