当出现滚动条时,FireFox偏移的长页面 [英] Long pages in FireFox offset when scrollbar appears

查看:112
本文介绍了当出现滚动条时,FireFox偏移的长页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Firefox和Safari中,当页面长到足以显示滚动条时,居中的页面会移动几个像素。如果您浏览的网站有长短网页,则网页似乎会跳跃。



IE7往往会让滚动条在所有时间都可见,当页面不够长时禁用它。由于HTML窗口的宽度从不改变,页面的中心不会改变。



有一个解决方法或一种方式来设置页面风格,在Firefox和Safari中跳转?



感谢。

解决方案

可以简单地总是启用滚动条:

  html {
overflow:
}

但是这会给你水平滚动条, p>

  html {
overflow-y:scroll;
overflow-x:auto;
}

这将只给出垂直滚动和水平。 p>

In Firefox and Safari, pages that are centered move a few pixels when the page is long enough for the scrollbar to appear. If you navigate through a site that has long and short pages, the page seems to "jump" around.

IE7 tends to leave the scroll bar visible all of the time but disables it when the page is not long enough. Since the width of the HTML window never changes the centering of the page doesn't change.

Is there a workaround or a way to style the page so it doesn't jump around in Firefox and Safari?

Thanks.

解决方案

You could simply always enable the scrollbar:

html{
 overflow: scroll;
}

but that would give you the horizontal scrollbar too, this is better:

html{
   overflow-y:scroll;
   overflow-x:auto;
}

That will give you only the vertical scroll and the horizontal when needed.

这篇关于当出现滚动条时,FireFox偏移的长页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆