Site moves over 5 pixels if site is below browser height [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionSo apparently my site I'm building for my old high school likes to move over about 5px to the left/right when navigating.
Navigate to Administration or Clinic under the About Us and the site will move ever-so slightly to the left or right. Apparently it will move if the sites content exceeds the browsers height. I've experienced this before. Why?
The site
Are you talking about the scrollbar that appears to the right, causing the entire site to indeed shift a bit for the scrollbar?
One solution could be to simple add a scrollbar to each page, even if it's not needed.
Try this css:
html {
overflow-y: scroll;
}
(you might want to add that to body as well)
Add to your stylesheet:
html {
overflow-y: scroll;
}
When the content is taller than the browser's viewport it will cause the vertical scrollbar to appear. This reduces the viewport width by approximately 20px hence your content shifts 10px towards left (10px since it is center-aligned). Possible workaround:
- Page Shift Bothers Me
- Fixing "Page Shift" Problem
精彩评论