CSS Select box arrow style

前端 未结 2 1488
广开言路
广开言路 2020-11-28 16:33

I want to remove the default arrow from the select box and want to use custom icon. From the previous answers on SO, I have found out that it is not possible (to make it wor

2条回答
  •  误落风尘
    2020-11-28 17:00

    Please follow the way like below:

    .selectParent {
    	width:120px;
    	overflow:hidden;   
    }
    .selectParent select { 
    	display: block;
    	width: 100%;
    	padding: 2px 25px 2px 2px; 
    	border: none; 
    	background: url("http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/br_down.png") right center no-repeat; 
    	appearance: none; 
    	-webkit-appearance: none;
    	-moz-appearance: none; 
    }
    .selectParent.left select {
    	direction: rtl;
    	padding: 2px 2px 2px 25px;
    	background-position: left center;
    }
    /* for IE and Edge */ 
    select::-ms-expand { 
    	display: none; 
    }

提交回复
热议问题