…without using margin:0 auto;
Why? It causes pages with a scrollbar to have a different center position than those pages without scrollbar, so when navigating through pages, divs are jumping. What would you suggest, guys?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m afraid the “jumping” effect is unavoidable because the scrollbars affect the viewport width, which in turn affects the centreline of the page. This happens regardless of technique (
text-align: center;,position: -50%;, etc).The workaround is to force the vertical scrollbar to always appear. Use this:
From here, but you can disregard most of the samples on that page and jump to the bottom.
Note that
overflow-xandoverflow-ywere originally Microsoft extensions on the CSS2.x standardoverflowproperty. However bothoverflow-xandoverflow-yare in CSS3.