【发布时间】:2021-11-25 12:29:37
【问题描述】:
我正在 Angular 13 中开发一个示例项目,其中我使用了 Angular Material 主题。在组件中,我使用材料按钮进行注销确认对话框窗口,我在 css 中将按钮背景颜色更改为白色,但是当我运行项目时,即使应用 css 后它仍然显示默认灰色 .有什么方法可以强制更改角度材质颜色,因为我使用的那个不起作用。
下面是代码文件,便于理解
logout-dialog.component.html
<h1 mat-dialog-title class="logout-heading">Logout</h1>
<div mat-dialog-content>
<p class="message">Are you sure you want to logout ?</p>
</div>
<div mat-dialog-actions class="buttons-div">
<button mat-button class="cancel" (click)="cancel()">Cancel</button> //THIS BUTTON SHOULD HAVE WHITE BACKGROUND
<button mat-button class="logout" (click)="logout()">Ok</button>
</div>
logout-dialog.component.css
.cancel {
border: 1px solid #3f51b5;
color: #3f51b5;
background-color: #fff !important;
}
有什么解决办法吗?
【问题讨论】: