How to use a:hover in Inline Css
In this tutorial, we are going to learn about how to apply a hover effect to the anchor (<a>
) element in inline css.
Normally, there is no way to use a:hover
in inline css because the pseudo-class selectors only work on external stylesheets, but we can apply the same hover effect to an html anchor
element using JavaScript onmouseover
and onmouseout
event.
Here is an example:
<a href="https://google.com"
onmouseover="this.style.color='red'"
onmouseout ="this.style.color='blue'">
google.com
</a>
Now, if we hover on the above element it will change to red
color and if mouse moves away from the element it wll change to blue
color.