After extensive searching, I have found two reasonable approaches for creating custom pure-CSS select drop-downs.
Approach #1. Original article here
Wrap the select element in a div with a fixed width (say 150 pixels) and overflow hidden.
Then give the select element a width of about 20 pixels greater than the div.
The result is that the default drop-down arrow of the select element will be chopped off, and you can place any background image you want on the right-hand-side of the div.
The advantage of this approach is that it is cross-browser (Internet Explorer 8 and later, WebKit, and Gecko). However, the disadvantage of this approach is that the options drop-down juts out on the right-hand-side (by the 20 pixels which we hid... because the option elements take the width of the select elment).
[It should be noted, however, that if the custom select element is necessary for MOBILE this above problem doesn't apply - because of the way each phone natively opens the select element. So for mobile, this is probably the best solution.]
[Here's a demo of this approach]
Approach #2 Original post here
Use the pointer-events
property.
The idea here is to overlay an element over the native drop down arrow (to create our custom one) and then disallow pointer events on it.
Advantage: No extra markup, works well in WebKit and Gecko.
Disadvantage: Internet Explorer doesn't support pointer-events
. (even Internet Explorer 10), which means you can't click the custom arrow. Also, another (obvious) disadvantage with this method is that you can't target your new arrow image with a hover effect or hand cursor, because we have just disabled pointer events on them!
However, with this method you can use Modernizer or conditional comments to make Internet Explorer revert to the standard built in arrow.
This, in my opinion is the best available solution to date (at least until the appearance
property gets wider browser support).
Here is a fiddle (which uses the second approach together with Internet Explorer conditionals) where you can verify this.
Being that Internet Explorer 10 doesn't support conditional comments
anymore: If you want to use approach #2, you should probably use Modernizr. However, it is still possible to exclude the pointer-events CSS from Internet Explorer 10 with a CSS hack described in Stack Overflow question How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?.