停止滚动条向左推送内容 [英] Stop scrollbar from pushing content left
问题描述
我正在设计一个网站,我有多个页面使用相同的模板,有些页面比浏览器窗口的高度长,其他页面不高。更长的那些被推到他左边大约10px,这可能听起来不多,但是当切换页面时,一切都向侧面跳跃,这是显而易见的。
I'm designing a website and I have multiple pages that use the same template, some pages are longer than the browser window's height, other's aren't. The ones that are longer get pushed to he left by about 10px, this might no sound like much but it's noticeable when switching pages as everything jumps sideways.
是否有一些CSS我可以做的事情是让每个页面上的滚动条显示在内容上而不是推动它,我在模板中有一个边距,所以如果浏览器窗口太小,当用户滚动到最右边时它将覆盖边距。
Is there some CSS thing I can do to make the scroll bar on each page appear over the content rather than pushing it, I have a margin in the template so if the browser window is too small it will just cover the margin when the user scrolls to the far right.
推荐答案
这样做的唯一方法是让滚动条始终可见。
The only way to do this is to have the scrollbar always visible.
html { overflow-y: scroll; }
这篇关于停止滚动条向左推送内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!