html - 悬停时更改 Angular Material 扩展标题的颜色

标签 html css angular angular-material

我有一个 Angular Material 7 扩展面板。当我将鼠标悬停在其中一个 ma​​t-expansion-panel-header 上时,颜色会发生变化。我怎样才能改变这种颜色?

代码:

<mat-accordion>
    <mat-expansion-panel>
          <mat-expansion-panel-header>
            <mat-panel-title>
              Titel
            </mat-panel-title>
            <mat-panel-description>Hi</mat-panel-description>
          </mat-expansion-panel-header>
          Content
    </mat-expansion-panel>
</mat-accordion>

最佳答案

您可以在标题中添加一个类,并将悬停时的背景颜色设置为 currentColor,例如

<mat-accordion>
    <mat-expansion-panel>
          <mat-expansion-panel-header class="disable_ripple">
            <mat-panel-title>
              Titel
            </mat-panel-title>
            <mat-panel-description>Hi</mat-panel-description>
          </mat-expansion-panel-header>
          Content
    </mat-expansion-panel>
</mat-accordion>

然后在 css 中

.disable_ripple:hover{
background: currentColor !important;
}

Working example

关于html - 悬停时更改 Angular Material 扩展标题的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54514402/

相关文章:

html - 当为 html、body 定义溢出时,键盘向下按钮不起作用

Angular2 在表达式中加入字符串

angular - 错误类型错误 : Cannot read property 'call' of undefined

html - float div 在 IE7 中扩展到 100%

javascript - 在页面或子页面上使用 PHP 将事件类添加到导航链接?

html - 表格数据不在 div 下滚动

html - Div 添加滚动条即使溢出 : hidden

html - hide 设置为 false 后聚焦输入

html - 创建具有 html 功能分组的模板

php - "Make this your Default Search engine"按钮?