1

I want to change the background color of angular mat button on hover.

html

<button  style="font-family: 'Nunito'" button mat-button color="primary">Button</button>

css:

button.mat-raised-button:hover {
    background-color: 'red';    
}

BUt it is not working and I dont know why?

Artem Arkhipov
  • 7,025
  • 5
  • 30
  • 52
gaurav singh
  • 35
  • 1
  • 4

2 Answers2

2

Add a class while hover the button hover-class

button mat-raised-button color="primary" class="hover-class">Primary</button>

then

.hover-class:hover {
  background-color: red;
}

Working Demo

Rayees AC
  • 4,426
  • 3
  • 8
  • 31
-1

Your HMTL and CSS are invalid check the snippet:

button.mat-raised-button:hover {
    background-color: red;    
}
<button  style="font-family: 'Nunito'" class="mat-raised-button" color="primary">Button</button>
SoliMoli
  • 781
  • 2
  • 6
  • 25