2013-04-13 41 views
0

我試圖創建一個導航菜單的圖像。儘管Chrome和Firefox沒有問題,但鏈接在IE9中不起作用。懸停效果也不起作用。圖像鏈接和懸停不起作用,即

查了一下我在提前www.sabourinpaulwedding.ca

謝謝了。 Gilles

HTML是左側的垂直導航欄和右側的內容div。

<div> 
    <ul class="nav"> 
    <li class="welcome"><a class="selected" href="#"></a></li> 
    <li class="ceremony"><a href="ceremony.html"></a></li> 
    <li class="reception"><a href="reception.html"></a></li> 
    <li class="accommodations"><a href="accommodations.html"></a></li> 
    <li class="registry"><a href="registry.html"></a></li> 
    </ul> 
</div> 
<div class="content"> 
    <p>Welcome to the digital home of the future Mr. and Mrs. Paul.</p> 
    <p>&nbsp;</p> 
</div> 

該CSS使用圖像來顯示懸停的鏈接和選定的鏈接。 看來,IE瀏覽器無法訪問導航欄,因爲一個「不可見」的div在上面。 我用導航欄的z-index玩過。這沒有用。

ul.nav 
{ 
    list-style-type: none; 
    padding: 0; 
    margin: 0; 
    float: left; 
    z-index: 20; 
} 

ul.nav a 
{ 
    border: 0px solid #cccccc; 
    display: block; 
    height: 0px; 
    padding-top: 72px; 
    width: 265px; 
    overflow: hidden; 
} 

/* Welcome Button */ 
.nav li.welcome a { background:url('images/welcome_en_normal.png') no-repeat; background-position:0px 0px; } 
.nav li.welcome a:hover { background:url('images/welcome_en_hover.png') no-repeat; background-position:0px 0px; } 
.nav li.welcome a.selected { background:url('images/welcome_en_selected.png') no-repeat; background-position:0px 0px; } 

/* Ceremony Button */ 
.nav li.ceremony a { background:url('images/ceremony_en_normal.png') no-repeat; background-position:0px 0px; } 
.nav li.ceremony a:hover { background:url('images/ceremony_en_hover.png') no-repeat; background-position:0px 0px; } 
.nav li.ceremony a.selected { background:url('images/ceremony_en_selected.png') no-repeat; background-position:0px 0px; } 

工作雖然是從內容一側刪除所有p標籤......但我確實需要一些內容(顯然)。問題不在於css .p選擇器,因爲如果我刪除了那裏的所有內容,這些鏈接仍然不起作用。

+1

請出示一些努力至少把你的(適當的)代碼放到你的文章中......你有什麼嘗試過嗎? – Lemurr

+0

Obligatory [您嘗試過什麼?](http://whathaveyoutried.com) –

+0

可能是因爲z-index問題,即覆蓋A標籤的另一個元素,它會吞噬點擊事件。代碼或鏈接是必需的。 – cdonner

回答

0

這可能是因爲標籤是空試試這個標記

<ul class="nav"> 
    <li class="welcome"><a href="#" class="selected">Welcome</a></li> 
    <li class="ceremony"><a href="ceremony.html">Ceremony</a></li> 
    <li class="reception"><a href="reception.html">Reception</a></li> 
    <li class="accommodations"><a href="accommodations.html">Accomodations</a></li> 
    <li class="registry"><a href="registry.html">Registry</a></li> 
    </ul> 

和CSS

ul.nav a { 
    border: 0 solid #CCCCCC; 
    display: block; 
    height:0; 
    padding-top: 72px; 
    width: 265px; 
    overflow:hidden; 
} 

有被搜索引擎友好的獎金副作用

+0

謝謝。我試過這個代碼,但它沒有這樣做。有沒有辦法強制導航欄位於正確內容的「頂部」? 就好像鼠標無法訪問IE中的導航菜單。如果我刪除內容中的p標籤,鏈接將起作用。 – user2276485

+0

你能爲我們提供一些東西嗎? – Stephen

+0

我從來沒有聽說過jsfiddle。我會看看我能做什麼。 – user2276485