简体   繁体   English

保证金:0px自动不适用于苹果野生动物园

[英]Margin: 0px auto didn't work in apple safari

I have a construction that works well in all browsers except iPhone Safari, it sticks to left side though it's not supposed to. 我的构造可以在除iPhone Safari之外的所有浏览器中很好地工作,尽管本来不应该,但它会贴在左侧。

.home{width: 980px; .home {width:980px; margin: 0px auto 0px auto;} 保证金:0px自动0px自动;}

any advice? 有什么建议吗?

无论如何,我认为iPhone屏幕宽度不会超过980px ^^

In my case it wasn't working because the parent element was a flex div that wasn't properly prefixed. 在我的情况下,它不起作用,因为父元素是一个未正确添加前缀的flex div。 Here follows the solution if you fall into the same situation: 如果遇到相同的情况,请遵循以下解决方案:

.parent {
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

.child {
    margin: 0px auto;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM