Style SELECT (Pure CSS)
Style <select> element using pure CSS. Full support in Firefox, Chrome, IE 10+ and graceful degradation for other browsers.
by Ayyappan Sakthivadivel
HTML
<form>
<select>
<option>Item One</option>
<option>Item Two</option>
</select>
</form>
CSS
body {
font-family: Arial, sans-serif;
font-size: 12px;
}
select {
border: 0px solid #ccc;
height: 25px;
line-height: 12px;
margin: 0;
padding: 0px 20px;
background: #000 none no-repeat;
cursor: pointer;
color:#838383;
}
@media screen and (min-width:0) {
/* for relatively modern browsers including IE 8+ */
select {
border-radius: 4px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAZCAYAAADnstS2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAH9JREFUeNpi/P//PwOxgImBBDDsFTP+dyJeMQsQMwNxLBCz4VF3B4j3gRT/BWJRIO7CofA7EJsgu7kbiHfgUFwAxNfQPRgHxC/QFK4E4lnYQuM1EIdCnQUC94E4HV/QHQHieiD+BcQRQPyRUNCBQgckupuicGYcTc+DTzFAgAEARhcb0a4IYZcAAAAASUVORK5CYII=");
background-position: -50px -50px;
}
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* for Webkit */
select {
-webkit-appearance: none;
background-position: 220px center;
/*control width*/
padding: 3px 171px 3px 20px;
}
}
@-moz-document url-prefix() {
/* for Firefox */
select {
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: "";
background-position: right center;
/*controls width of main area*/
padding-right: 171px;
}
/* hides the dotted outline on focus in FF (See SO#3773430) */
select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* for IE10+ */
select::-ms-expand {
display: none;
}
select {
background-position: right center;
/*controls width?*/
padding-right: 170px;
}
}