html5 移动端 select,移动端select兼容性问题【原创】

最近在做微信的项目,每次写到地址的选择,只要用select,在手机上总会出现这样那样的不兼容问题,经过多次查资料,终于找到一个可以用的方法,具体代码如下:

弋江区

所在地址

.list-bottom .district{

display: inline-block;

float: right;

margin-right: 10px;

text-align: right;

font-size: 14px;

color: #808080;

cursor: pointer;

}

.button {

border: none;

border-radius: 1px;

}

.custom-select {

position: relative;

}

.custom-select select {

width:100%;

margin:0;

background:none;

border: 1px solid transparent;

outline: none;

-webkit-box-sizing: border-box;

-moz-box-sizing: border-box;

box-sizing: border-box;

appearance: none;

-webkit-appearance: none;

line-height:1.3;

}

.custom-select::after {

content: "";

position: absolute;

width: 0px;

height: 0px;

top: 50%;

right: -9px;

margin-top:-4px;

border:8px solid #929497;

border-width: 8px 5px 8px;

border-color: #929497 transparent transparent transparent;

z-index: 2;

pointer-events:none;

}

/* Focus style */

.custom-select select:focus {

height: 40px;

box-shadow: 0 0 1px 3px rgba(180,222,250, 1);

/*background-color:transparent;*/

/*color: #222;*/

border:1px solid #aaa;

}

/* Set options to normal weight */

.custom-select option {

font-weight:normal;

}

x:-o-prefocus, .custom-select::after {

display:none;

}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {

.custom-select select::-ms-expand {

display: none;

}

.custom-select select:focus::-ms-value {

background: transparent;

color: #222;

}

}

@-moz-document url-prefix() {

.custom-select {

overflow: hidden;

}

.custom-select select {

width: 120%;

width: -moz-calc(100% + 3em);

width: calc(100% + em);

}

}

.custom-select select:-moz-focusring {

color: transparent;

text-shadow: 0 0 0 #000;

}

转载时请注明出处及相应链接,本文永久地址:https://blog.yayuanzi.com/15866.html

75d087ef9a9fb11dc373caaf33adbf7f.png

微信打赏

支付宝打赏

感谢您对作者erin的打赏,我们会更加努力!    如果您想成为作者,请点我

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值