2011-04-14 107 views
1

我遇到了一个问题,我的CSS只发生在IE7中,我希望别人之前遇到过这个问题。基本上我们有一个客户网格设计,当单元格悬停时单元格突出显示。这个效果很好,但是在IE7中突出显示的棍子,你在单元格上方,然后离开单元格,突出显示仍然存在。鼠标悬停在IE7

这里是我使用的电池

.cell input:hover 
{ 
    background-color: #54B5FF; 
} 

感谢CSS!

编辑:家长

.cell input 
{ 
border:none; 
background:transparent; 
padding:11px 6px; 
width:35px; 
height:16px; 
line-height:16px; 
text-align:right; 
background-color:transparent; 
border-radius:0;-moz-border-radius:0;-webkit-border-radius:0; 
} 

编辑:发现修复!

我发现了一个修复程序,我想我会与其他人在未来遇到这个错误分享。显然,在IE7中,只有某些样式更改会导致称为hasLayout的情况,这显然会导致它正确地重新呈现。在我的情况下,我将代码更改为

.cell input:hover 
{ 
position: static; 
background-color: #D7ECFF; 
} 

这并没有改变任何东西,但它确实导致IE7正确渲染它!

+0

稍候... IE7支持上投入悬停?你根本不使用JavaScript? – 2011-04-14 21:37:08

+0

是的,看到我的编辑解决方案 – confused 2011-04-14 22:03:01

+0

经过一番挖掘,我发现IE7确实支持:hover伪类与严格的文档类型一起使用时。你懂得越多。 – 2011-04-15 16:50:38

回答

0

设置默认值。

尝试:

.cell input { 
    background-color: #fff; /* or whatever you want it to be... */ 
} 

.cell input:hover 
{ 
    background-color: #54B5FF; 
} 
+0

对不起,我应该发布父母 '.cell input { \t border:none; \t背景:透明; \t padding:11px 6px; \t width:35px; \t height:16px; \t line-height:16px; \t text-align:right; \t background-color:transparent; \t border-radius:0; -moz-border-radius:0; -webkit-border-radius:0; }' – confused 2011-04-14 21:33:46