2011-05-03 90 views
2

這段代碼有什麼錯? css不起作用問題與css

<style type="text/css"> 
    .mail a:link { 
     color: grey; 
    } 

    .mail a:visited { 
     color: grey; 
    } 

    .mail a:hover { 
     color: white; 
    } 
</style> 

<a class="mail" href="mailto:[email protected]">E-mail: [email protected]</a> 

回答

7

你的CSS樣式應用到錨是.mail的後代,而不是與類名郵件錨元素的元素。

更改樣式定義爲如下:

<style type="text/css">  
    a.mail:link {   
     color: grey;  
    }  

    a.mail:visited {   
     color: grey;  
    }  

    a.mail:hover {   
     color: white;  
    } 
</style> 
+0

解決了感謝。我將接受答案 – anvd 2011-05-03 20:58:55

+0

切線提示:使用.mail(http://moorer.me/jP97GR)會更有效。同樣,您可以忽略:未訪問鏈接的鏈接。 – morewry 2011-05-03 21:07:04

3

'a'不是.mail的後代。

嘗試a.mail