前端 - Safari:select下拉框的字体不能居中。
问题描述
在chrome上使用text-align没有用,后来试了下text-align-last:center有作用,但是在Safari上 是无效的;
Google后也没发现什么有价值的,有哪位遇到过吗?
问题解答
回答1:有一个hack的办法
在select的位置写一个span,用js去绑定span里的值和select的值,让span元素居中,隐藏掉select。
大约是这样的:
js的内容就自己写一下吧
.pesu-select { text-align: center;border:solid 1px #000; } .pesu-select select { position: absolute; left: 0px; top: 0px; width: 100%; height: 42px; opacity: 0; } <p class='pesu-select'> <span>aaa</span> <select> <option value='1'>aaa</option> <option value='2'>bbb</option> <option value='3'>ccc</option> </select> </p> 回答2:
其他途径解决问题:select外面包一层p,select的宽度不设置(由内容撑开),设置容器的宽度与text-align:center;
相关文章:
1. docker不显示端口映射呢?2. dockerfile - 为什么docker容器启动不了?3. html5 - 如何让H5页面在手机浏览器里和微信全屏显示4. angular.js - angularjs的自定义过滤器如何给文字加颜色?5. docker镜像push报错6. 为什么我ping不通我的docker容器呢???7. docker 17.03 怎么配置 registry mirror ?8. angular.js使用$resource服务把数据存入mongodb的问题。9. 关于docker下的nginx压力测试10. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””

网公网安备