CSS 隐藏 select 框的下拉箭头

阅读(10828)

通过各类-prefix-appearance(-webkit-appearance,-moz-appearance)可以达到隐藏下拉框右侧箭头的目的,但在Firefox下,最新版本也是支持的,中间有些版本失效,不过这份额也可以忽略了。

IE10起,-ms-expand也可以实现去掉下拉箭头的效果。


<style type="text/css">
/*IE 10 */
select::-ms-expand{
    display: none;
}
select{
    /* Chrome */
    -webkit-appearance: none;
    /* Firefox */
    -moz-appearance: none;
    text-indent: 0.01px;
    text-overflow: ' '; /* space */
}
</style>

<select>
    <option>Hide arrow</option>
</select>

参考:
How to hide the select arrow in Firefox
IE ::-ms-expand pseudo-element
MDN -moz-appearance(-webkit-appearance)