即使已设置溢出,水平滚动条也仅在IE7中出现:已设置隐藏 [英] Horizontal scrollbar appears only in IE7 even with overflow:hidden being set
问题描述
我正在为此努力奋斗.
我有一个令人不安的水平滚动条,仅当在IE7中浏览我的网站时才会出现:
http://www.regia.it
I have a disturbing horizontal scrollbar that appears only when browsing my site in IE7:
http://www.regia.it
我已经尝试并尝试通过在div
上使用overflow:hidden
来阻止这种情况的发生,但是由于某种原因,我似乎似乎找不到导致问题的原因.
I have tried and tried to stop this from happening by using overflow:hidden
on my div
s but for some reason I just can't seem to find what is causing the problem.
非常感谢您的帮助.
推荐答案
这似乎很奇怪.我假设您不介意即使在小屏幕上该页面也无法水平滚动,因为您尝试使用:
This does seem odd. I am assuming you don't mind if the page is not horizontally scrollable even on small screens, since you have tried to use:
body{overflow-x: hidden;}
在这种情况下,如果将其应用于html
而不是body
,则可以达到目的:
In which case if you apply it to html
rather than body
it should do the trick:
html{overflow-x: hidden;}
我并不是很想实施这个长期计划,但是,如果您正在寻找一种快速解决方案,那么在您确定出问题所在之前,将其作为一种临时措施应该是可以的.我还会在有条件的评论中添加它,以免破坏大多数人在现代浏览器上的体验.
I wouldn't really want to implement this long term, but if you are looking for a quick fix this should be ok as a temporary measure until you can work out what is going wrong. I would also put it in a conditional comment so as not to ruin the experience for the majority of people on modern browsers.
<!--[if IE 7]>
Link to alternate style sheet
OR
<style> /*CSS in here*/ </style>
<![endif]-->
我已经找到了问题的根源,因此不需要使用上述替代方法.我怀疑这个问题与绝对和相对定位有关.
EDIT : I have found the cause of the issue, so there is no need to use the above workaround. As I had suspected the issue was related to absolute and relative positioning.
您只需要从.grid_2
和.grid_12
中删除position:relative
,滚动条就会消失.
You just need to remove position:relative
from .grid_2
and .grid_12
and the scrollbar will disappear.
这篇关于即使已设置溢出,水平滚动条也仅在IE7中出现:已设置隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!