我只想更改p-table
一个组件的标题单元格的背景颜色,我该怎么办?
我试过了 <ng-template pTemplate="caption" class="myStyle">
并.myStyle{ background: rgb(9,169,121) !important; }
在my.component.scss中
但这不起作用。
帮我!谢谢!
编辑:终于可以了!我看到了@Antikhippe的答案,但我不得不添加
:host :: ng-deep {#myTable {.p
-datatable-thead {背景:红色;
} .p-datatable .p-datatable-thead> tr> th {背景:继承;} }}
pTemplate="caption"
只适合表标题的一部分,您必须在p-datatable-header
课堂上工作:
尝试这个:
:host ::ng-deep {
#myTable {
.p-datatable-header {
background-color: red;
}
}
}
我将p-datatable-header
类包围在一起#myTable
,仅将此CSS用于myTable
ID为ID的表:
<p-table id="myTable" [value]="products">
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句