UC手机浏览器下如何让div水平垂直居中。
UC浏览器在宽高固定下,margin:auto,上下左右0;不能水平垂直居中是什么原因?
CSS
#globalTip{ position: fixed; left: 0; right: 0; top:0; bottom:0; z-index: 99999; width:75%; height: 50px; line-height: 50px; text-align: center; background-color: #000; color:#fff; font-size: 1.6rem; border-radius: 20px; }
如果position:absolute就可以,但这并不是我想要的。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(5)
蒲公英的约定2022-09-08 05:47:28
我后来换了另一种水平垂直居中写法
css
#globalTip{ position: fixed; left:50%; top:50%; z-index: 99999; margin-left: -35%; margin-top:-25px; width:75%; height: 50px; line-height: 50px; text-align: center; background-color: nth($theme-color,1); color:#fff; font-size: 1.6rem; border-radius: 20px; }
但依然想知道UC浏览器用原写法怎么解决bug
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
display: table-cell;
vertical-align: middle;