繁体   English   中英

如何更改按钮的字体颜色

[英]How to change mat-button font color

我有一个带有以下代码的按钮:

<button mat-button (click)="getStock()" >Go </button>

我在styles.css中为整个应用程序设置了背景色

html { background-color:#a9c5f2 };

与Mat按钮相对应的CSS组件代码

.mat-button {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    background-color: #659bf2;
    border-color: #659bf2;
    height:100px;
    width:300px;
    white-space: normal;
    color: black !important;
}

浏览器中的垫按钮中的文本为灰色。

我该如何解决?

有一个基于此的指令,该指令将带有颜色选项。

<button mat-button color="black" (click)="getStock()">Go</button>

还发现了这个堆叠闪电战 ,其中展示了您可以使用mat-button操作的一些示例

官方文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM