用纯css改变下拉列表select框的默认样式

select {
 position:relative; /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/ border: solid 1px #000; /*很关键:将默认的select选择框样式清除*/ appearance:none; -moz-appearance:none; -webkit-appearance:none;
/*为下拉小箭头留出一点位置,避免被文字覆盖*/
  padding-right: 14px;
}


/*清除ie的默认选择框样式清除,隐藏下拉箭头*/
select::-ms-expand { display: none; }

select:after {  
  content: ' ';
   position: absolute;
    pointer-events: none;//值none:元素永远不会成为鼠标事件的targetpointer-events属性被指定为从下面的值列表中选择的一个关键字。详解此属性 http://www.zhangxinxu.com/wordpress/2014/01/pointer-events-none-avoiding-unnecessary-paints/
   border: 4px solid transparent;  
  border-top-color: #B5B5B5;  
    z-index: 999;  
  bottom: 8px;
   right: 5px;
}

猜你喜欢

转载自www.cnblogs.com/wdd-cindy/p/8882038.html