问题与CSS

anv*_*nvd 2 html 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:astark1@unl.edu">E-mail: suporte@web.pt</a>
Run Code Online (Sandbox Code Playgroud)

Cha*_*ndu 7

您的css样式适用于作为.mail后代的锚元素,而不适用于具有类名mail的锚元素.

将样式定义更改为如下所示:

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

    a.mail:visited {         
        color: grey;     
    }     

    a.mail:hover {         
        color: white;     
    }   
</style> 
Run Code Online (Sandbox Code Playgroud)