Search code examples
hyperlinkhoveranchormailto

CSS - link hover doesn't work


Does anyone know how to make CSS link hover properties work for links that don't link to another html page or anchor?

For example this works:

<a href="page1.html">Page1</a>
<a href="#page9">Link</a>

a:hover,a:visited:hover{
color:#fff;
text-decoration:none;
}
a:link,a:visited{
color:#555;
text-decoration:none;
}

But the moment I change the link to something that's not an anchor or an html file, let's say a mailto:

<a href='mailto:bla@bla.com'>Send email</a>

It no longer changes color when I hover over the link. Why is this?


Solution

  • You are overriding your own styles. Try

        <style type="text/css">
            a:link, a:visited
            {
                color: #555;
                text-decoration: none;
            }
            a:hover, a:visited:hover
            {
                color: #fff;
                text-decoration: none;
            }
        </style>