Created
February 22, 2017 05:41
-
-
Save shelldandy/74afe372486c760681ae9ab2892117e8 to your computer and use it in GitHub Desktop.
Bullet proof custom selects with css only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$caret: url(BASE_64_PNG); | |
.custom-select { | |
appearance: none; | |
border-radius: 0; // Safari Mac/iOS | |
border: none; // Safari Mac/iOS/Firefox | |
display: block; | |
width: 100%; | |
background: { | |
size: 12px; // Size of your caret | |
repeat: no-repeat; | |
position: 95% 50%; // X-axis Y-axis | |
image: $caret; // Base64 for IE | |
} | |
&::-ms-expand { // IE | |
display: none; | |
} | |
&:-moz-focusring { // Firefox | |
color: transparent; | |
text-shadow: 0 0 0 #000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Designers sure love their custom selects and after tons of experimenting this is a really cross-browser solution with css-only.
Remember to pass this file through autoprefixer as usual