首页 > 解决方案 > 角度表头颜色和显示

问题描述

我正在尝试将 Angular mat 表格标题中占位符的颜色更改为白色,但它不起作用。

而且,我想显示全文“Action”而不是“A ...”如何解决这个问题?

在此处输入图像描述

HTML 代码:

    <th mat-header-cell *matHeaderCellDef> 

        <mat-select placeholder="Action" (selectionChange)="filter($event)">
           <mat-option value="all"> View All </mat-option>
           <mat-option value="some"> View some</mat-option>
         </mat-select>
    </th>

CSS:

th {
  color: white;
}

.mat-select-value-text {
  color: white !important;
}
.mat-select-panel mat-option.mat-option {
  height: unset;
  color: white;
}

.mat-option-text.mat-option-text {
  white-space: normal;
  color: white;
}

标签: cssangularmat-table

解决方案


试试你的CSS

:host /deep/ .mat-select-value-text { }

我也试过了,但是不行

::ng-deep .mat-select-value-text { }

也许这可以帮助你

https://blog.angular-university.io/angular-host-context/


推荐阅读