CSS 溢出:隐藏不适用于移动浏览器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18268300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Overflow:hidden not working on mobile browser
提问by youaremysunshine
Im using overflow:hidden to hide my unglam div in my webpage, it works well in all web browser but not in mobile browser. Anyone can help?
我使用溢出:隐藏在我的网页中隐藏我的 unglam div,它在所有网络浏览器中运行良好,但在移动浏览器中运行良好。任何人都可以帮忙吗?
body
{
margin: auto;
display:block;
overflow-x:hidden;
overflow-y:hidden;
height:800px;
}
回答by Pranav Kale
Try adding following line in your html
尝试在您的 html 中添加以下行
<meta name="viewport" content="width=device-width, height=device-height">
and test on your phone. Maybe this should help.
并在您的手机上进行测试。也许这应该有所帮助。
回答by LolaRoux
Add a wrapper inside your body
tag and apply the overflow-x: hidden
to that wrapper
在您的body
标签内添加一个包装器并将 应用overflow-x: hidden
到该包装器
回答by MattDiamant
Depending on which mobile browser you're using, overflow-x
and overflow-y
may not be supported. Use overflow: hidden
instead to cover all bases and be cross browser compatible.
取决于您使用的移动浏览器,overflow-x
并且overflow-y
可能不受支持。改用overflow: hidden
覆盖所有基础并跨浏览器兼容。