2011-10-08 47 views
2

我在懸停功能上有<a>標記存在問題。IE懸停在鏈接上不起作用

<a href='#' onClick='javascript:showPrev();'class='prev'> </a> 

問題出在CSS代碼中。如果我在a{}a:hover{}中設置了background-color,圖像將會顯示。否則,如果沒有background-color或設置爲none,則圖像不會在懸停時顯示。

這裏是我的CSS

a.next { 
    outline:none; 
    position: absolute; 
    text-decoration:none; 
    color:black; 
    z-index: 800; 
    left: 534px; 
    top: 0px; 
    width: 266px; 
    height: 600px; 
    display: inline; 
} 

a.prev { 
    outline:none; 
    position: absolute; 
    text-decoration:none; 
    color:black; 
    z-index: 800; 
    left: 0px; 
    float:left; 
    top: 0px; 
    width: 266px; 
    height: 600px; 
    display: inline; 
} 

#slideshow a.next:hover { 
    outline:none; 
    position: absolute; 
    text-decoration:none; 
    color:black; 
    z-index: 800; 
    left: 534px; 
    top: 0px; 
    width: 266px; 
    height: 600px; 
    display: inline; 
    background:url(../images/next.png) 90% 65% no-repeat; 
} 

#slideshow a.prev:hover { 
    outline:none; 
    position: absolute; 
    text-decoration:none;  
    color:black; 
    z-index: 800; 
    left: 0px; 
    float:left; 
    top: 0px; 
    width: 266px; 
    height: 600px; 
    display: inline; 
    background:url(../images/prev.png) 10% 65% no-repeat; 
} 

有誰知道可能是什麼問題?提前致謝。

+1

給我們呈現出了問題的URL,請。 –

+0

http://closecurly.kodingen.com/bm/project.html?n=COVERED_CLUSTER&p=1&i=33 這裏是鏈接,您可以在Chrome測試例子,看看它應該怎樣做。然後,即 – Isen

回答

0

有似乎是一些奇怪的IE問題,這意味着一個標籤留在形象背後,除非你設置背景屬性可能搞亂了IE的努力,我不能,爲什麼此刻鍛鍊......

但是...

您可以通過複製你的背景解決這個從屬性:懸停狀態的「正常」狀態的一個,和然後添加一個大的負面背景位置,所以他們有效地隱藏ñ直到他們上空盤旋,例如:

a.next { 
    outline:none; 
    position: absolute; 
    text-decoration:none; 
    color:black; 
    z-index: 800; 
    left: 534px; 
    top: 0px; 
    width: 266px; 
    height: 600px; 
    display: inline; 

    background:url(../images/next.png) 90% -1000% no-repeat; 
} 

這應該工作

+0

謝謝老兄。我從來沒有想過這種方法。太感謝了。 – Isen

0

你有\只是#slideshow a.next:hover{之前它在解析你的CSS

+0

不太可能,因爲他提到,加入'背景color'解決它是問題。 (除非他錯了,顯然) –

+0

這是發佈時的錯字。我現在已經刪除它。它不在實時代碼中。 – Isen