2

what is wrong in this code? css is not working

<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>

2 Answers 2

7

Your css styles apply to anchor elements that are descendants of .mail and not the anchor elements with class name mail.

Change the style definitions to as below:

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

    a.mail:visited {         
        color: grey;     
    }     

    a.mail:hover {         
        color: white;     
    }   
</style> 
Sign up to request clarification or add additional context in comments.

1 Comment

Tangential Tip: it's more efficient to just use .mail (moorer.me/jP97GR). Similarly, you can omit :link for unvisited links.
3

'a' is not a descendent of .mail.

Try a.mail

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.