CSS:菜单链接的背景图像在 IE 8 中不可见
我正在开发的网站有一个菜单,其中包含徽标图像作为最后一个链接的背景。由于某种原因,该图像不会出现在 IE 中,即使它在所有其他浏览器中显示良好。
这是网站:
如果有人可以看一下我的 CSS 并建议 Internet Explorer 版本:
#access {
left:70%;
top:140px;
margin-left:-600px;
width: 280px;
z-index:999;
position:relative;
float:left;"
}
#access ul {
-moz-box-shadow: 0 0 5px -1px #888;
-webkit-box-shadow: 0 0 5px -1px #888;
box-shadow: 0 0 5px -1px #888;
}
#access ul,
#access ul ul {
list-style-type:none;
width: 250px;
}
#access ul ul {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
display:none;
}
#access ul li:hover > ul {
display: block;
}
#access ul li:last-child {
height:77px;
background: url(images/aba/ABALinkRed.jpg) no-repeat top left;
text-indent: -3000px;
-moz-box-shadow: 0 0 5px -1px #888;
-webkit-box-shadow: 0 0 5px -1px #888;
box-shadow: 0 0 5px -1px #888;
}
#access ul li:last-child a {
background:transparent;
height:77px;
}
#access ul ul li:last-child {
background:transparent;
height:32px;
text-indent: 0px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
#access ul ul li:last-child a {
background:#fff;
background: rgba(255, 255, 255, 0.85);
height:18px;
}
#access ul a,
#access ul ul a {
display:block;
padding: 7px 0 7px 10px;
background:#fff;
background: rgba(255, 255, 255, 0.85);
text-decoration:none;
color:black;
}
#access ul ul {
padding-left:40px;
margin-left:-20px;
}
#access ul ul a {
margin-left: -20px;
padding-left:20px;
width:230px;
}
#access ul a:hover,
#access ul ul a:hover {
color: #CA0000;
}
#access ul li.current_page_item > a,
#access ul li.current-menu-ancestor > a,
#access ul li.current-menu-item > a,
#access ul li.current-menu-parent > a {
color: #CA0000;
}
The website I'm working on has a menu that includes a logo image as a background for the last link. For some reason that image doesn't appear in IE, even though it shows up fine in all other browsers.
Here's the site:
I would appreciate it if someone could take a look at my CSS and suggest the Internet Explorer version:
#access {
left:70%;
top:140px;
margin-left:-600px;
width: 280px;
z-index:999;
position:relative;
float:left;"
}
#access ul {
-moz-box-shadow: 0 0 5px -1px #888;
-webkit-box-shadow: 0 0 5px -1px #888;
box-shadow: 0 0 5px -1px #888;
}
#access ul,
#access ul ul {
list-style-type:none;
width: 250px;
}
#access ul ul {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
display:none;
}
#access ul li:hover > ul {
display: block;
}
#access ul li:last-child {
height:77px;
background: url(images/aba/ABALinkRed.jpg) no-repeat top left;
text-indent: -3000px;
-moz-box-shadow: 0 0 5px -1px #888;
-webkit-box-shadow: 0 0 5px -1px #888;
box-shadow: 0 0 5px -1px #888;
}
#access ul li:last-child a {
background:transparent;
height:77px;
}
#access ul ul li:last-child {
background:transparent;
height:32px;
text-indent: 0px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
#access ul ul li:last-child a {
background:#fff;
background: rgba(255, 255, 255, 0.85);
height:18px;
}
#access ul a,
#access ul ul a {
display:block;
padding: 7px 0 7px 10px;
background:#fff;
background: rgba(255, 255, 255, 0.85);
text-decoration:none;
color:black;
}
#access ul ul {
padding-left:40px;
margin-left:-20px;
}
#access ul ul a {
margin-left: -20px;
padding-left:20px;
width:230px;
}
#access ul a:hover,
#access ul ul a:hover {
color: #CA0000;
}
#access ul li.current_page_item > a,
#access ul li.current-menu-ancestor > a,
#access ul li.current-menu-item > a,
#access ul li.current-menu-parent > a {
color: #CA0000;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它适用于 IE9,所以我假设您使用的是 IE8。
这就是添加图像的方式:
它不起作用的原因是 IE 版本 9 之前不支持
:last-child
,请参阅:http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx#pseudoclassesIt works in IE9, so I assume you're using IE8.
This is how you're adding the image:
The reason it doesn't work is that
:last-child
is not supported in IE until version 9, see: http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx#pseudoclasses