1

I am using (https://github.com/FortAwesome/angular-fontawesome) and everything looks good with what the basic documentation has:

<fa-icon [icon]="faCoffee"></fa-icon>

My issue is I want to have a 'hover to change color'. When I do the following:

<fa-icon [icon]="faCoffee" [inverse]="true" class="colorchange"></fa-icon>

Then have CSS that says:

.colorchange {
}

.colorchange:hover {
color:red !important;
}

The CSS appears to do nothing. What is the right way to get a simple basic hover color change to work? I tried wrapping the fa-icon element with a span tag and applied a class to that and it didn't work either.

Rolando
  • 58,640
  • 98
  • 266
  • 407

1 Answers1

2

Here is a quick workaround. Going through their source, it can be seen they use a selector class called ng-fa-icon. So applying :hover pseudo to this class should work.

.ng-fa-icon.hover-hightlight:hover {
  color: red;
}
<fa-icon class="hover-hightlight" [icon]="['fas', 'square']"></fa-icon>

Working example: Stackblitz

ruth
  • 29,535
  • 4
  • 30
  • 57