Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
188
rated 0 times [  190] [ 2]  / answers: 1 / hits: 47054  / 11 Years ago, mon, october 21, 2013, 12:00:00

I have an anchor tag with a font-awesome icon as follows



<a href=# class=lock><i class=icon-unlock></i></a>


Is it possible to change to icon on hover to a different icon?



my CSS



.lock:hover{color:red}


Aside from the icon turning red I'd also like to change the icon to the following



<i class=icon-lock></i>


Is this possible without the help of JavaScript? Or do I need Javascript/Jquery on hover for this?



Thank you.


More From » html

 Answers
10

You could toggle which one's shown on hover:



HTML:

<a href=# class=lock>
<i class=icon-unlock></i>
<i class=icon-lock></i>
</a>


CSS:

.lock:hover .icon-unlock,
.lock .icon-lock {
display: none;
}
.lock:hover .icon-lock {
display: inline;
}


Or, you could change the content of the icon-unlock class:



.lock:hover .icon-unlock:before {
content: f023;
}

[#74827] Sunday, October 20, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaliyahcynthiac

Total Points: 91
Total Questions: 94
Total Answers: 119

Location: Vanuatu
Member since Wed, Oct 14, 2020
4 Years ago
;