Skip to content

Instantly share code, notes, and snippets.

@dbox
Created December 17, 2015 05:24
Show Gist options
  • Save dbox/4afbdb8e6f5e44b99479 to your computer and use it in GitHub Desktop.
Save dbox/4afbdb8e6f5e44b99479 to your computer and use it in GitHub Desktop.
.custom-select {
border: 1px solid rgba(0,0,0,0.25);
border-radius: 0.2em;
display: block;
padding: 0;
position: relative;
background: #fff;
color: rgba(0,0,0,0.7);
width: 200px;
}
.custom-select select {
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: none;
border: 1px solid transparent;
border-radius: 0.2em;
color: inherit;
font-size: 1em;
line-height: 1.3;
margin: 0;
padding: 0.3em 1.9em 0.5em 0.8em;
outline: none;
width: 100%;
}
.custom-select select:focus {
background-color: transparent;
outline: none;
border: 1px solid rgba(0,0,0,0.45);
box-shadow: 0 0 1px 3px #b4defa;
}
.custom-select:after {
content: "";
pointer-events: none;
position: absolute;
right: 0.7em;
margin-top: -0.25em;
top: 50%;
width: 6px;
height: 6px;
z-index: 2;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid rgba(0,0,0,0.25);
}
.custom-select:hover {
border: 1px solid rgba(0,0,0,0.45);
background: #fff;
}
.custom-select:hover:after {
border-top: 6px solid rgba(0,0,0,0.45);
}
.custom-select option {
font-weight: normal;
}
@-moz-document url-prefix() {
overflow: hidden;
.custom-select select {
width: 120%;
width: calc(100% + 3em);
}
.custom-select select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
.custom-select select option {
backround: #fff;
}
}
.custom-select select::-ms-expand {
display: none;
}
.custom-select select:focus::-ms-value {
background: transparent;
color: #222;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment