修改浏览器select默认样式

修改浏览器select默认样式
   <div class="select">
       <select name="brower">
          <option value="one">新东方培训网站</option>
          <option value="two" selected>在线干部培训网站</option>
       </select>
   </div>

IE10+以及其他浏览器

/*去掉下拉箭头,给select添加背景 */
select {
    width: 260px;
    width: 280px\9\0;  
    height: 36px;
    font-size: 14px;
    color: #6e6e6e;
    padding-left: 10px;
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background: #fff url(img/select.png) no-repeat scroll 96% center;
    box-sizing: border-box;
}
/*去掉ie下select下拉箭头*/
select::-ms-expand {
    display: none; 
}

IE9的处理方式

在IE9浏览器下的样式(目前没有总结完)

方法一

其他浏览器写法:
background-color:#f00;/*all*/
background-color:#0ff\0;/* ie 8/9 */
background-color:#0f0\9\0;/* ie9 */
*background-color:#00f;/*ie7*/
_background-color:#ff0;/*ie6*/
background-color//:#090;/*非IE*/
background-color:#900\9;/*所有ie*/

方法二:(在html的head里)

<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]-->
<!--[if IE]> 所有的IE可识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->
<!--[if IE 8]> 仅IE8可识别 <![endif]-->
<!--[if IE 9]> 仅IE9可识别 <![endif]-->
  <!--[if IE 9]>
    <style>
        select {
            background-position: 90% center !important;
        }
    </style>
  <![endif]-->
/*在select外层添加一个div,比select本身的宽度要短,overflow:hidden把下拉箭头隐藏*/
select {
    width: 280px\9\0;  
}
.select {
    width: 260px;
    overflow: hidden;
    display: inline-block;
    margin-right: 49px;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值