卸下IE10选择元素箭(Removing the IE10 Select Element Arrow

2019-07-21 08:47发布

因此,使用Mozilla和WebKit我有一个半体面的解决办法更换的箭头select采用箱体appearance: none; 和具有父元素。

在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; 但是不起作用。 所以,我能做些什么吗?

Answer 1:

避免浏览器探测和条件注释(这是不支持如Internet Explorer 10的),而是采取更标准的做法。 有了这个特殊的问题,您应该瞄准::-ms-expand伪元素:

select::-ms-expand {
    display: none;
}


Answer 2:

但是!如果我们想增加宽度,我们不能也这样做:

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;
}


Answer 3:

Internet Explorer的10不支持条件注释 ,所以你只好去其他地方做一些事情。 一种解决方案是嗅出用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功能从Microsoft网页 ,然后更改if以这样的:

if (getInternetExplorerVersion() >= 10) {
    // whatever implementation you choose
}


Answer 4:

我有一个隐藏的下拉箭头在网站上的IE 10和11,我的工作,它使用Zurb基金会的问题。 有上有_form.scss线

select::-ms-expand {
    display: none;
}

删除它和下拉箭头开始正常显示在所有broswers。 感谢您乔纳森的回答在这里。 这种搜索了很多的解决方案后,帮助了我。



Answer 5:

仍然不知道你想什么来完成,但这会检测并添加了IE10类:



文章来源: Removing the IE10 Select Element Arrow