2012-07-24 72 views
0

对于主页,我有一个html文件,其中包含由图像精灵表示的四个链接。精灵显示正确,并在悬停时更改,当在桌面上使用html文件测试代码时,悬停属性工作正常(即使在ie8中),但在我的SharePoint站点上实施时,:hover的鼠标悬停部分不是由于某种原因而被识别,并且图像不会根据需要变回原始状态。此代码将工作时,我用Firefox提出共享点,甚至会在ie8工作,但只有当我提出ie的开发工具和开关Browser Mode:IE8Document Mode:IE8 StandardsCSS伪类:悬停在内容编辑器中webpart在ie8/ie7中无法正常工作

如何让图像在未被占用时恢复到原始状态?

这里是我的代码段referencia:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

<head> 
<meta http-equiv="Content-Language" content="en-us" /> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<style type="text/css"> 
#navlist{position:relative;} 
#navlist li{margin:0;padding:0;list-style:none;position:absolute;} 
#navlist li, #navlist a{height:50px;display:block;} 



#one{left:0px;width:250px;} 
#one{background:url('images/newMenuSprite.png') 0px -1px;} 
#one a:hover{background: url('images/newMenuSprite.png') 0px -226px;} 

#two{left:0px;width:250px;top:54px} 
#two{background:url('images/newMenuSprite.png') 0px -53px;} 
#two a:hover{background: url('images/newMenuSprite.png') 0px -278px;} 

#three{left:0px;width:250px;top:108px} 
#three{background:url('images/newMenuSprite.png') 0px -105px;} 
#three a:hover{background: url('images/newMenuSprite.png') 0px -330px;} 

#four{left:0px;width:250px;top:162px} 
#four{background:url('images/newMenuSprite.png') 0px -157px;} 
#four a:hover{background: url('images/newMenuSprite.png') 0px -382px;} 

</style> 


</head> 

<body> 

<ul id="navlist" style="top:100px"> 
<li id="one"><a href="h.html"></a></li> 
<li id="two"><a href="t.html"></a></li> 
<li id="three"><a href="m.html"></a></li> 
<li id="four"><a href="l.html"></a></li> 
</ul> 

</body> 

</html> 

谢谢您的时间,

回答

1

有没有必要使用相同的图像背景都normal:hover状态。 改为设置background-position

#four a:hover { background-position: 0px -382px; } 
+0

哎呀,有错误。试试这个'#four a:hover {background-position:0px -382px; }' – Roman 2012-07-24 18:23:24

+0

没有。有双**我**这是错误。 – Roman 2012-07-24 18:29:25