html css it is not possible to have inline styles for different aspects of an element like hover, and visited

You cannot specify css styles for different aspects of an HTML element.

e.g. I wanted to do something like this. But you CAN NOT do this.


<a href="www.unicef.org" style="hover(color:00AEFD);active(color:00AEFD)">

Unfortunately the only solution is to write a custom css class and use it.

Like this:


<style>
a.unicef:link {
color: #00AEFD;
text-decoration: none;
}

a.unicef:visited {
color: #00AEFD;
text-decoration: none;
}

a.unicef:hover {
color: #00AEFD;
text-decoration: none;
}

a.unicef:active {
color: #00AEFD;
text-decoration: none;
}
</style>

Then use the class in your link


<a href="http://www.unicef.org.uk/Donate/Donate-Now" class="unicef" target="_blank">Please Donate To unicef</a>

——————

References:
W3 Schools
Stack Overflow

 

This entry was posted in General, Web Development and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *