因此,对于Mozilla和WebKit,我有一个不太好的解决方案,用appearance: none;替换select框上的箭头,并拥有一个父元素。
在IE的大部分时间里,我禁用了这个功能。对于IE10,我实际上不能禁用它,因为我的条件注释实际上不起作用。
这是我的标记:
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)]> <html class="ie10plus"> <![endif]-->
<!--[if !(IE)]><!--> <html> <!--<![endif]-->类ie10plus实际上并没有使它成为标记的方式。
我也觉得也许有一种合法的方式来替代IE中的箭头。我并不反对实际解决这个问题。但是,appearance: none;不起作用。那么我能在这里做些什么呢?
发布于 2013-04-11 02:38:46
避免浏览器嗅探和条件注释(从Internet Explorer10开始不支持),而采用更标准的方法。对于这个特定的问题,您应该针对::-ms-expand伪元素:
select::-ms-expand {
display: none;
}发布于 2014-05-21 15:52:37
但是!,如果我们想增加宽度,我们不能这样做:
display:none
所以
select::-ms-expand {
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* IE 5-7 */
filter: alpha(opacity=0);
/* Good browsers :) */
opacity:0;
}发布于 2013-03-12 10:05:01
Internet Explorer 10 doesn't support conditional comments,所以你必须做一些其他的事情。一种解决方案是使用JavaScript嗅探用户代理,然后自己添加类:
<script>
if (navigator.userAgent.indexOf("MSIE 10.0") !== -1) {
document.documentElement.className += " ie10";
}
</script>您可能应该将它添加到<head>中,这样您就不会有大量未设置样式的内容,但这可能不是问题。
此外,如果您使用的是jQuery,则可能需要执行以下操作:
if (navigator.userAgent.indexOf("MSIE 10.0") !== -1) {
$("html").addClass("ie10");
}如果要检查IE10或更高版本,请复制粘贴getInternetExplorerVersion函数from this Microsoft page,然后将if更改为如下所示:
if (getInternetExplorerVersion() >= 10) {
// whatever implementation you choose
}https://stackoverflow.com/questions/15351949
复制相似问题