【发布时间】:2021-01-17 16:59:19
【问题描述】:
Angular Material 文档中有一些我想重用的东西,我想以正确的方式来做: https://material.angular.io/components/categories 我想在顶部栏上放置具有相同 div.mat-button-focus-overlay 的按钮:
.mat-button-focus-overlay {
background-color: rgba(0,0,0,.12);
}
无论我做什么,我所拥有的一切都是这样的:
.mat-button-focus-overlay {
background-color: rgba(63, 81, 181, 0.12);
}
这使我的颜色与条形相同,因此悬停时的叠加层不可见。例子: https://stackblitz.com/edit/angular-lwmxw7
如何以正确的方式做到这一点?我不想使用任何技巧,只有最佳实践:)
编辑:
我发现了一些奇怪的东西......当我把它放到组件的 scss 文件中时:
body mat-toolbar.mat-toolbar button.mat-button div.mat-button-focus-overlay {
background-color: rgba(0,0,0,0.12);
}
它不起作用,看起来它甚至不存在于浏览器的样式列表中(?),但是移到 style.scss 的相同代码就像一个魅力......谁知道为什么?
【问题讨论】:
标签: css angular sass angular-material2