html - 自定义选择不适用于 IE9

标签 html css internet-explorer-9

我的这个选择在 IE9 上表现得很奇怪。 首先,应该打开 wiki 页面的链接仅在 IE9 浏览器上不起作用,第二个问题是悬停,为什么当光标越过帮助并注销时图标被悬停背景颜色覆盖?

<ul id="main">
        <li class="username" tabindex="1" >  <a>USER</a>
            <ul class="curent_buser">
                <li class="help"><a href="http://www.wikipedia.org/">Help</a></li>
                <li class="logoff"><a href="http://www.wikipedia.org/">LogOff</a></li>
            </ul>
        </li>
    </ul> 

CSS:

ul#main {
    color: gray;
    width: 120px;
    border-left: 1px solid #f2f2f2;
    border-right: 1px solid #f2f2f2;
    border-top: 1px solid #f2f2f2;
    list-style: none;
    font-size: 12px;
    letter-spacing: -1px;
    font-weight: bold;
    text-decoration: none;
    height:30px;
    background:green;
}



ul#main:hover {
    opacity: 0.7;
    text-decoration: none;
}

#main > li{
    background: url('http://cdn1.iconfinder.com/data/icons/crystalproject/24x24/actions/1downarrow1.png') 100% 0 no-repeat;
    outline:0;
    padding:10px;
}

ul#main li ul {
    display: none;
    width: 116px;
    background: transparent;
    border-top: 1px solid #eaeaea;
    padding: 2px;
    list-style: none;
    margin: 7px 0 0 -3px;
}


ul.curent_buser li a {
    color: gray;;
    cursor: pointer;
}
ul.curent_buser{
    background:lime !important;    
    }


    ul#main li ul li a {
    display: block;
    padding: 5px 0;
    position: relative;
    z-index: 5;
}


#main li:focus ul, #main li.username:active ul {
    display: block;
}

.help{
    background: url("http://cdn1.iconfinder.com/data/icons/musthave/16/Help.png") no-repeat 100% center ;
    height: 25px;
    margin-bottom: 2px;
    border-bottom: 1px solid white;
}       

.help:hover{    
background: #f4f4f4;


}

.logoff{
    background: url("http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/on-off.png") no-repeat  100% center ;
    height: 25px;
}


.logoff:hover{
    background: #f4f4f4 ;
    height: 25px;
}

.help a,.logoff a{
    color:gray;
    font-family: Museo700Regular,sans-serif;
    letter-spacing: 0;
    font-size: small;
}

​

fiddle :http://jsfiddle.net/RwtHn/1455/

最佳答案

我至少可以帮助您解决图标问题。问题是您正在用一种颜色覆盖背景。 您可以有颜色或背景图像。不是都。您将需要在背景中使用基本相同但颜色不同的不同图像,悬停时不显示图像或悬停时不显示颜色。

很抱歉,我无法为 IE 问题提供更多帮助。对于这样的事情,我真的很讨厌 IE。

编辑:这是你可以按照下面的评论中提到的那样做的事情

 .logoff:hover{
             background: #f4f4f4 url("http://cdn1.iconfinder.com/data/icons/cc_mono_icon_set/blacks/16x16/on-off.png");
             height: 25px;
    }

感谢 ANeves 提供此信息。我在这里也学到了一些东西。

关于html - 自定义选择不适用于 IE9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12897397/

相关文章:

javascript - AngularJS:在指令 Controller 中呈现 HTML

zend-framework - Zend Framework 以 HTML5 方式附加脚本和样式表

javascript - jQuery UI 对话框内容宽度不会改变

css - 图像未出现在 View 中

css - IE9 不喜欢我的下拉框?

javascript - 将鼠标悬停在图像上时在图像上显示文本

html - 如何制作固定大小的表格单元格而不考虑其内容

html - 移动相对定位的元素后​​如何避免出现空格?

ruby-on-rails - Rails 3.1 与最新的 jQuery-UJS IE9 希望将响应保存为 .js

css - Gulp 缩小 css 在 IE9 中不起作用