如何强制显示垂直滚动条? [英] How do I force a vertical scrollbar to appear?
本文介绍了如何强制显示垂直滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网站页面既短又长.由于我使用margin: 0 auto
将其在视口中居中,因此当从具有滚动条的页面切换到没有滚动条的页面时,它会跳动几个像素.
My site has both very short and longer pages. Since I center it in the viewport with margin: 0 auto
, it jumps around a few pixels when switching from a page that has a scrollbar to one that hasn't and the other way around.
是否有一种方法可以强制垂直滚动条始终显示,以便我的网站在浏览时保持原状?
Is there a way to force the vertical scrollbar to always appear, so my site stays put when browsing it?
推荐答案
给您的body
标签和overflow: scroll;
body {
overflow: scroll;
}
,或者如果您只想使用垂直滚动条,请使用overflow-y
or if you only want a vertical scrollbar use overflow-y
body {
overflow-y: scroll;
}
这篇关于如何强制显示垂直滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文