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

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: