select 下拉框的样式改变

最近在做地图遇到一个很有意思的事情,就是select下拉框的样式改变

 

/*第一种,改变下拉框样式*/ select { /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/ border: solid 1px #000; /*很关键:将默认的select选择框样式清除*/ appearance:none; -moz-appearance:none; -webkit-appearance:none; /*在选择框的最右侧中间显示小箭头图片*/ background: url("http://ourjs.github.io/static/2015/arrow.png") no-repeat scroll right center transparent; /*为下拉小箭头留出一点位置,避免被文字覆盖*/ padding-right: 14px; } /*清除ie的默认选择框样式清除,隐藏下拉箭头*/ select::-ms-expand { display: none; } /*第二种,下拉框的样式透明化*/ 不过我自己也用了特别简单粗暴的方法,主要不太想动脑 select{ border: solid 1px transparent; } 让我们的select框直接消失

posted on 2017-09-25 11:32  share水边  阅读(2652)  评论(0编辑  收藏  举报

导航