2012-07-24 74 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