我在 wordpress 网站上有水平滚动,它在所有计算机上都可以在 chrome 中运行,但在某些计算机上的 safari 和 firefox 上不能运行。
我的代码是:
html {
height:100%;
overflow-x:hidden;
}
body {
width:3080px;
overflow-y:hidden;
}
当我删除 overflow-x:hidden;水平滚动有效,但您可以看到滚动条。 这是网站的链接 http://happybirthday.irinanisimova.com/photography/
如何隐藏滚动条?您还知道为什么这在 safari 和 firefox 的某些计算机上有效,但在所有计算机上无效吗?
谢谢!
最佳答案
当我想更改默认滚动条时,我通常会创建一个容器 div,然后在上面而不是在主体上设置我想要的溢出。尝试将溢出切换到宽度和高度为 100% 的容器 div,并删除 body 标签上的宽度和溢出。
html {
overflow:hidden;
}
#container {
width:100%;
overflow:auto;
white-space: nowrap;
}
img {
display:inline-block;
}
<div id="container">
put images in here
</div>
关于css - 水平滚动中断 overflow-x :hidden in safari and firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14620667/