【问题标题】:How to change angular material button background color on hover?如何在悬停时更改角度材质按钮背景颜色?
【发布时间】:2020-09-14 06:18:26
【问题描述】:

我想在悬停时更改角垫按钮的背景颜色。

html

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

css:

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

但它不工作,我不知道为什么?

【问题讨论】:

  • 使用background-color: red !important ..我认为它会帮助你..

标签: html css angular-material


【解决方案1】:

悬停按钮hover-class时添加一个类

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

然后

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

Working Demo

【讨论】:

    【解决方案2】:

    你的HMTLCSS无效检查sn-p:

    button.mat-raised-button:hover {
        background-color: red;    
    }
    &lt;button  style="font-family: 'Nunito'" class="mat-raised-button" color="primary"&gt;Button&lt;/button&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-12
      • 2014-09-09
      • 1970-01-01
      • 2021-03-22
      • 2019-06-23
      相关资源
      最近更新 更多