Changing tab text color on selection

若如初见. 提交于 2019-12-11 01:07:24

问题


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;
 } */

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


回答1:


You need to use the following class for active tab:

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

Here is a link to working demo.




回答2:


.mat-tab-label-active .mat-tab-label-content {
 //your style here
}


来源:https://stackoverflow.com/questions/45961849/changing-tab-text-color-on-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!