[英]HTML hide Select drop down arrow with css
Is there a good way hide the default drop down arrow for all browsers? 是否有一种好方法可以隐藏所有浏览器的默认下拉箭头? I know the question has been asked couple times but there does NOT seem to be a solution which would work for all browsers and neither of them look nice.
我知道问题已被问过几次,但似乎没有一个适用于所有浏览器的解决方案,它们都不好看。 Couple years has passed already and I wonder if there exists a good solution now?
几年已经过去了,我想知道现在是否有一个好的解决方案?
The best way I could fine is this: 我可以解决的最好方法是:
select::-ms-expand
{
display: none;
}
select
{
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
padding: 2px 30px 2px 2px;
/*border: none; - if you want the border removed*/
}
This works in Chrome and IE. 这适用于Chrome和IE。
Unfortunately in your case -moz-appearance:none does not seem to currently be fully supported. 不幸的是在你的情况下-moz-appearance:目前似乎没有完全支持none 。
There is a bug here: https://bugzilla.mozilla.org/show_bug.cgi?id=649849 which which has a RESOLVED FIXED status but seems to be dependant on another bug here: https://bugzilla.mozilla.org/show_bug.cgi?id=1076846 which has a NEW status so hopefully it will be fixed soon. 这里有一个错误: https ://bugzilla.mozilla.org/show_bug.cgi?id = 649849,它有一个已解决的固定状态,但似乎依赖于另一个错误: https : //bugzilla.mozilla.org/ show_bug.cgi?id = 1076846具有NEW状态,所以希望很快就会修复。
https://gist.github.com/joaocunha/6273016/ https://gist.github.com/joaocunha/6273016/
select {
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
text-indent: 0.1;
text-overflow: '';
}
For webkit browswers, -webkit-appearance: none
will remove ALL of the default browser's select
styling. 对于webkit浏览器,
-webkit-appearance: none
将删除所有默认浏览器的select
样式。 Keep in mind that this is reliable, but it will remove ALL styling, not just the arrow. 请记住,这是可靠的,但它将删除所有样式,而不仅仅是箭头。 There is no other dependable solution at this point.
目前还没有其他可靠的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.