What is causing this shift in layout? CSS? [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this questionI have been following the RoR tutorial and noticed that my layout appears to shift while moving between nav links. Rather than link to my actual project, you can see what I am talki开发者_如何学编程ng about by looking at the author's personal homepage: www.michaelhartl.com/ If you move between the nav links at the top, the whole page appears to shift. I am guessing that this has nothing to do with RoR, and more with CSS.
Some pages have scrollbars, some others don't. When the scrollbar appears it shift it left some pixels. (If this is what you mean.)
As Sotiris said, some pages have scrollbars and some don't, due to the amount of content on the page. You can force scrollbars to appear on every page and prevent this apparent 'shift' by putting the following in your CSS file:
html { overflow-y: scroll; }
精彩评论