如何防止滚动条重新定位网页? [英] How to prevent scrollbar from repositioning web page?
本文介绍了如何防止滚动条重新定位网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网站与中心对齐的DIV。现在,一些页面需要滚动,有些页面不滚动。当我从一种类型移动到另一种类型,滚动条的外观将页面移动几个像素到一边。有没有办法避免这种情况,而不显式地显示每个页面上的滚动条?
I have a website with center-aligned DIV. Now, some pages need scrolling, some don't. When I move from one type to another, the appearance of a scrollbar moves the page a few pixels to the side. Is there any way to avoid this without explicitly showing the scrollbars on each page?
推荐答案
overflow-y:你应该使用它与html标签,而不是body或者你得到一个双滚动条在IE 7
所以正确的CSS将是:
overflow-y:scroll is correct, but you should use it with the html tag, not body or else you get a double scrollbar in IE 7
So the correct css would be:
html {
overflow-y: scroll;
}
这篇关于如何防止滚动条重新定位网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文