开发者

Site moves over 5 pixels if site is below browser height [closed]

开发者 https://www.devze.com 2023-04-03 08:17 出处:网络
Closed. 开发者_Go百科This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. 开发者_Go百科This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

So 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
0

精彩评论

暂无评论...
验证码 换一张
取 消