css modify the default style drop-down list select the

html code:

<div>

     <select name= "" >
 
         <option value= "芝士" >芝士</option>
         <option value= "奶油" >奶油</option>
     </select>
</div>
Adding to select the parent element div purpose of, covered with select styles div style
select{ //清除select的边框样式
            bordernone; //清除select聚焦时候的边框颜色
            outlinenone; //将select的宽高等于div的宽高
            width100%;
            height40px;
            line-height40px; //隐藏select的下拉图标
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none; //通过padding-left的值让文字居中
            padding-left60px;
 }

 

// use pseudo-classes to select Add icon they want to use
div:after{
  content: "";
  width: 14px;
  height: 8px;
  background: url(img/xiala.png) no-repeat center;
   // By positioning the icon in the right place
  position: absolute;
  right: 20px;
  top: 45%;
   // custom icons to click down function to achieve
  pointer-events: none;
}

 

 

 

 

Guess you like

Origin www.cnblogs.com/zxhh/p/12155251.html