Reputation: 7887
Here's the Stackblitz.
I'm trying to apply the CSS color: blue
to the div with class mat-button-toggle-label-content
, but its not getting applied.
A similar CSS is getting successfully applied to a parent element called mat-button-toggle-group
.
Upvotes: 1
Views: 938
Reputation: 5041
Just apply color to mat-button-toggle
and keep it inside mat-button-toggle-group
mat-button-toggle-group {
background-color: orange;
mat-button-toggle {
color: blue;
}
}
You can apply the style to .mat-button-toggle-label-content
but you need to break Encapsulation
.
Component styles are encapsulated. You can't access component's styles(classes, ids) from outside of the component. You need to pierce into that component and inject the styles like below
Note: /deep/ is deprecated and no more recommended. So you can go with above approach. And for more details check Component Styles
mat-button-toggle-group {
background-color: orange;
/deep/ .mat-button-toggle-label-content {
color: blue;
}
}
Upvotes: 1
Reputation: 578
There are many reason for that !
My solution is that you may need to put !important after color: blue;
it is : color: blue !important;
Upvotes: 0