css - 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就可以,但这并不是我想要的。
问题解答
回答1:display: table-cell;vertical-align: middle;
回答2:我后来换了另一种水平垂直居中写法
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
回答3:在absolute和fixed定位方式下使用
#globalTip{ position: fixed; left:50%; top:50%; -webkit-transform:translate3d(-50%,-50%,0); transform:translate3d(-50%,-50%);}回答4:
我也遇到了相同的问题uc下 水平垂直居中不管事解决方案
.box{ display: flex; justify-content: center; align-items: center;}
相关文章:
1. 点字符“” 在MVC Web API 2中进行请求,例如api / people / STAFF.452872. javascript - thymeleaf模板 只有length如何循环生成标签?3. javascript - node如何关闭主进程后 打开另一进程?4. 求大神指点js修改margintop导致无限下滑的问题5. web服务器 - ubuntu下布置apache加wsgi加python6. python3的各种库的官方文档中文版在哪儿可以找到7. mysql - sysbench cpu测试的结果看不懂,求解8. mysql新建字段时 timestamp NOT NULL DEFAULT ’0000-00-00 00:00:00’ 报错9. Mysql Begin End 语句报错10. python2.7为什么点击了"开始"按钮后,tkinter上的按钮,图中红色部分,再也点不动了?

网公网安备