如何只为一个按钮应用密度?
在我的 less 文件中定义样式中的密度不起作用:
.smallDiagramButton {
@include mat.button-density(-3);
}
稍后在 html 中使用它:
<button mat-raised-button color="primary" class="smallDiagramButton">Text</button>
无论我是否应用样式类,按钮“大小”(密度)都不会改变。
但是使用
@include mat.button-density(-3);
在全局 theme.scss 中,密度应用于我应用程序中的所有按钮 - 我不想这样做。