鼠标悬停效果在IE中不工作 [英] Mouse over effect is not working in IE

查看:168
本文介绍了鼠标悬停效果在IE中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码:

 < td width =70height =60> 
< a href =images / Gallery1 / 6.jpg =lightboxtitle =my title>
< img src =images / Gallery1 / thumbs / 6.jpgwidth =65height =40border =0class =gallery-img>
< / a>
< / td>

和CSS:

  .gallery-img {
border:4px solid #FFFFFF;
}
.gallery-img:hover {
border:4px solid#D4D5D8;
}

上述代码使用Firefox运行良好,

解决方案

如果您处于标准模式 / p>

如果您位于 : :




  • :hover 不适用于IE6中的非 - a 元素和Quirks模式下的IE7 / 8



事实上,你使用表格布局向我表明,所有可能的原因,在怪异模式是这里的答案。



阅读这篇详细详细的文章:



http://hsivonen.iki.fi/doctype/



简而言之,您需要确保您具有正确的doctype作为第一行例如:

 <!DOCTYPE html> 

您可以通过在IE中打开相关页面来验证我的意思,然后点击F12打开开发工具。如果对于文档模式它说怪异模式,您的CSS代码段将永远不会工作。添加doctype后,它应该说IE8 Standards,它应该都可以工作。



如果它仍然不工作,那么你有一些其他问题阻止IE使用标准模式。


My code:

<td width="70" height="60">
    <a href="images/Gallery1/6.jpg" rel="lightbox" title="my title" >
        <img src="images/Gallery1/thumbs/6.jpg"  width="65" height="40" border="0" class="gallery-img">
    </a>
</td>

And CSS:

.gallery-img{
    border:4px solid #FFFFFF;
}
.gallery-img:hover{
    border:4px solid #D4D5D8;
}

The above code runs fine using Firefox, but not when using IE 8. How can I fix this?

解决方案

That will work in IE8 if you are in Standards Mode.

It won't work if you're in Quirks Mode:

  • :hover doesn't work for non-a elements in IE6 and IE7/8 in Quirks Mode.

The fact that you're using tables for layout suggests to me that of all the possible causes, being in Quirks Mode is the answer here.

Read this long and detailed article:

http://hsivonen.iki.fi/doctype/

In short, you need to ensure you have a proper doctype as the very first line in your HTML, such as:

<!DOCTYPE html>

You can verify what I'm saying by opening the page in question in IE, and hitting F12 to open the Developer Tools. If for the "Document Mode" it says Quirks Mode, your CSS snippet will never work. After adding the doctype, it should say "IE8 Standards", and it should all work.

If it still doesn't work, then you have some other problem preventing IE using Standards Mode.

这篇关于鼠标悬停效果在IE中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆