我正在研究网站设计,并且我有一些图像悬停效果,当您将鼠标悬停在图像上时,图像上的元素会显示出来。它在Chome,Safari和FF上运行良好,但它在IE上不起作用,因为在IE上,:悬停代码只适用于:悬停。有没有办法为此提供JavaScript修补程序,或为整个div添加锚点,以便在每个浏览器上都能正常工作?这里是我的代码:是否有IE a:悬停修复?
<html>
<head>
<style>
body { background: #FFF; }
#postimage {
width: 500px;
height: 335px;
}
#topbar {
width: 500px;
background: rgba(0, 0, 0, 0.75);
height: 50px;
position: absolute;
z-index: 999;
}
#bottombar {
width: 500px;
background: rgba(0, 0, 0, 0.75);
height: 50px;
position: absolute;
z-index: 999;
margin-top: -50px;
}
#postimage div#bottombar{
display: none;
}
#postimage:hover div#bottombar {
display: inline;
}
#postimage div#topbar{
display: none;
}
#postimage:hover div#topbar {
display: inline;
}
</style>
</head>
<body>
<div id="postimage">
<div id="topbar">1</div>
<img src="http://28.media.tumblr.com/tumblr_lltiujAaV81qghzpno1_500.jpg" border="0">
<div id="bottombar">2</div>
</div>
IE 8和9支持任何元素的CSS悬停的指示,我不知道IE7。 IE6没有。 – kennebec 2011-05-26 20:13:56
只要您使用有效的文档类型,这只是IE6及更低版本的问题。我的建议是:放弃对IE6的支持。它会保存你的理智。 – Spudley 2011-05-26 20:15:57
我们目前有争论关于是否实际选择和未选中一堆答案为接受临门,或如果在系统中的错误元。您的意见将不胜感激! http://meta.stackexchange.com/questions/92858/whats-wrong-with-timeline(不,你没有做错任何事,我们只是一群好奇的忧心忡忡!) – 2011-05-27 03:38:13