CSS 中的 Angular Material 2 目标元素

Geo*_*ios 2 css angular-material angular

我使用 Angular Material 使 UI 更加“谷歌风格”,但我想在某些时候操作默认 CSS。例如,这是我的标记/角度材料代码:

   <mat-tab-group>
  <mat-tab label="Experience">
        <div *ngFor="let item of experienceItems"> 
          <mat-card>
             <mat-card-header>
             <mat-card-title> {{item?.startDate}} - {{item?.endDate}} <span class="card-company">{{item?.company}} - {{item?.location}}</span></mat-card-title>
              <mat-card-subtitle>{{item?.jobTitle}}</mat-card-subtitle>
            </mat-card-header>
            <mat-card-content>
              <i class="fa fa-keyboard-o" aria-hidden="true"></i>{{item?.description}}
            </mat-card-content> 
          </mat-card> 
          <br/>
       </div>
  </mat-tab>
</mat-tab-group> 
Run Code Online (Sandbox Code Playgroud)

我想从标签中替换一些默认值,例如:

.mat-tab-label{
    text-transform: uppercase;
    color: white;
    /*remove min-width*/
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用..

我的 CSS 位于:

@Component({
  selector: 'app-about',
  templateUrl: './template/app-about.html',
  styleUrls: ['./css/style.css']
})
Run Code Online (Sandbox Code Playgroud)

任何应用于其他元素的 CSS 都非常好。对于 Angular Material 元素,它没有。

欢迎任何帮助!

Mik*_*ung 5

对于角材料,您需要使用::ng-deep.

在你的 css 中做:

::ng-deep .mat-tab-label {
 text-transform: uppercase;
    color: white;
    /*remove min-width*/
}
Run Code Online (Sandbox Code Playgroud)