在选择时更改选项卡文本颜色 [英] Changing tab text color on selection

查看:36
本文介绍了在选择时更改选项卡文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Angular4,并且一直在使用有角材料.我创建了一个选项卡组,我想在选择任何选项卡时更改选项卡标签的文本颜色.我试图覆盖默认的 css,但这对我没有帮助.

I am working on Angular4 and have been using angular material. I have created a tab-group and I want to change the text color of a tab label when I select any tab. I have tried to override the default css but that didn't help me.

我可以覆盖墨水栏,但我无法在选择时覆盖标签文本颜色

I can override the ink bar but I am not able to override tab-text color upon selection

.mat-ink-bar{
    background-color:#00ADEE;
}
 /*.mat-tab-label::selection{
 color: #00ADEE !important;
 } */

我试图改变 tab-label-color 颜色的评论部分.

The commented part which I was trying to change the color of a tab-label-color.

推荐答案

您需要为活动选项卡使用以下类:

You need to use the following class for active tab:

.mat-tab-label-active {
     color: #00ADEE !important;
 } 

这是工作演示的链接.

这篇关于在选择时更改选项卡文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆