As this bug report states, there is an issue regarding Firefox's -moz-appearance
and <select>
elements: it was supposed to ditch the <select>
's arrow (like Chrome's implementation) but it simply doesn't. People were raging about the subject all over the internetz.
Until now.
I figured out a clever workaround to make it work on Firefox. Here is how to do it:
- Set
-moz-appearance
tonone
. This will "reset" the styling of the element; - Set
text-indent
to0.01px
. This will "push" the text a tiny bit to the right¹; - Set
text-overflow
to''
(an empty string). This will change anything that extends beyond the element's width to... nothing - and this includes the infamous arrow!
select {
-moz-appearance: none;
text-indent: 1px;
text-overflow: '';
}
No images, no extra markup, no javascript.
Tested on Ubuntu, Windows 8 and Mac, all with recent versions (20.x.x at least).
Follow me on twitter: @joaocunha
¹ Thanks for Binyamin for improving it from 1px to 0.01px.