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;}
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””2. boot2docker無法啟動3. docker-compose中volumes的問題4. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.5. nignx - docker內(nèi)nginx 80端口被占用6. java - SSH框架中寫分頁時service層中不能注入分頁類7. 關(guān)于docker下的nginx壓力測試8. dockerfile - 為什么docker容器啟動不了?9. node.js - antdesign怎么集合react-redux對input控件進行初始化賦值10. docker容器呢SSH為什么連不通呢?

網(wǎng)公網(wǎng)安備