2013-03-01 146 views
0

看起來你們是對的。改變訂單已經解決了這個問題。看起來像這樣一個簡單的修復。感謝所有的評論/幫助。CSS和鏈接問題


我有一些問題與我的鏈接和CSS。以下是我的網站代碼。我的問題是我有5個鏈接都使用相同的類。它們都能正確顯示並且鏈接正常工作,但懸停和活動不會改變。最後三項工作就是他們應該怎麼做。爲什麼是這樣?到底是怎麼回事?我已將其全部刪除並重新輸入。我試過不同的瀏覽器。刪除緩存。沒有。

HTML代碼:

<tr bgcolor="#FFFFFF"> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_02.gif" width="57" height="51" alt=""></td> 
    <td align="center" height="29"><a href="index.php" class="menu">Home</a></td> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_04.gif" width="41" height="51" alt=""></td> 
    <td align="center" height="29"><a href="about.php" class="menu">About</a></td> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_06.gif" width="36" height="51" alt=""></td> 
    <td align="center" height="29"><a href="products.php" class="menu">Products</a></td> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_08.gif" width="36" height="51" alt=""></td> 
    <td align="center" height="29"><a href="recipes.php" class="menu">Recipes</a></td> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_10.gif" width="36" height="51" alt=""></td> 
    <td align="center" height="29"><a href="contact.php" class="menu">Contact</a></td> 
    <td rowspan="2"> 
     <img src="images/layout/header-menu/menu_12.gif" width="58" height="51" alt=""></td> 

CSS代碼:

a.menu:link { 
color: #94AA45; 
text-decoration: none; 
font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
font-size: 22px; 
font-weight: normal;} 

a.menu:hover { 
color: #713010; 
text-decoration: none; 
font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
font-size: 22px; 
font-weight: normal;} 

a.menu:active { 
color: #F9A22E; 
text-decoration: none; 
font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
font-size: 22px; 
font-weight: normal;} 

a.menu:visited { 
color: #94AA45; 
text-decoration: none; 
font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
font-size: 22px; 
font-weight: normal;} 
+0

請將您的代碼放在小提琴中。 – Terry 2013-03-01 23:31:58

+0

將其更改爲.menu a:hover時發生了什麼? – ultraloveninja 2013-03-01 23:32:54

+0

@ultraloveninja但''是類'menu'的元素,不是? – Terry 2013-03-01 23:33:52

回答

0

設置訪問了你的CSS鏈接後出現。

辦法,我記住的是:* 大號 *Ø* V * E * HA * TE

經測試,在我的瀏覽器和重新安排工作的時候。問題是你訪問的風格是一樣的你的鏈接樣式,並覆蓋懸停(當你在的index.php)

+0

是的,它也適用於我。謝謝 – 2013-03-02 05:47:19

0

把你的鏈接的CSS順序:

一個

一個:拜訪

答:懸停

一:主動

對於你的榜樣,這個CSS應該按預期工作:

a.menu:link { 
    color: #94AA45; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal;} 

    a.menu:visited { 
    color: #94AA45; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal;} 


    a.menu:hover { 
    color: #713010; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal;} 

    a.menu:active { 
    color: #F9A22E; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal;} 
0

@Artur是對的,@Guido也是如此。

你絕對不想使用表格作爲導航元素。

這是我做了與你的代碼:

HTML:

<div class="menu"> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_02.gif" width="57" height="51" 
    alt=""> 
</td> 
<td align="center" height="29"><a href="#" class="menu">Home</a> 
</td> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_04.gif" width="41" height="51" 
    alt=""> 
</td> 
<td align="center" height="29"><a href="#" class="menu">About</a> 
</td> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_06.gif" width="36" height="51" 
    alt=""> 
</td> 
<td align="center" height="29"><a href="#" class="menu">Products</a> 
</td> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_08.gif" width="36" height="51" 
    alt=""> 
</td> 
<td align="center" height="29"><a href="#" class="menu">Recipes</a> 
</td> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_10.gif" width="36" height="51" 
    alt=""> 
</td> 
<td align="center" height="29"><a href="#" class="menu">Contact</a> 
</td> 
<td rowspan="2"> 
    <img src="images/layout/header-menu/menu_12.gif" width="58" height="51" 
    alt=""> 
</td> 
</div> 

CSS:

.menu a { 
    color: #94AA45; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal; 
} 
.menu a:visited { 
    color: #94AA45; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal; 
} 
.menu a:hover { 
    color: #713010; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal; 
} 
.menu a:active { 
    color: #F9A22E; 
    text-decoration: none; 
    font-family: TektonPro-BoldExt-FF, TektonPro-BoldExt, Geneva, Arial, Helvetica, sans-serif; 
    font-size: 22px; 
    font-weight: normal; 
} 

我也做了一個搗鼓這個問題,以及:

http://jsfiddle.net/ultraloveninja/D5rUR/

+0

得到它的工作,謝謝 – 2013-03-02 05:47:43