I have some components which use the mat-tab elements in the HTML. When trying to style these elements in the CSS, I am only able to style them using ::ng-deep .mat-tab-label {}
for example, and putting !important
next to at least one of the style changes. I do not want to leave this in the application long-term, especially after reading this article.
Here is how it breaks down looking at the elements in developer tools:
<mat-card class="mat-card">
<mat-tab-group class="mat-tab-group mat-primary">
<mat-tab-header class="mat-tab-header">
<div class="mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4 mat-ripple mat-tab-header-pagination-disabled>
<div class="mat-tab-label-container">
<div class="mat-tab-list">
<div class="mat-tab-labels">
<div class="mat-tab-label mat-ripple mat-tab-label-active ng-star-inserted">
<mat-ink-bar class="mat-ink-bar">
What can I do in order to style these elements without using ::ng-deep
and !important
in the CSS?