首页 > 解决方案 > angular-6-datatable 的自定义 CSS

问题描述

我正在使用Angular-6-datatable。我想为表头和分页器图标应用一些自定义 CSS。我们如何使用自定义 CSS 覆盖当前 CSSangular-6-datatable 截图我有一个全局 css 文件,我在其中添加“a”标签的颜色。在他们使用的包中 @Input("by") sortBy: string;

并将其附加到模板中

<a style="cursor: pointer;color: #ffffff;" (click)="sort()" class="text-nowrap"> <ng-content></ng-content> <span *ngIf="isSortedByMeAsc" class="glyphicon glyphicon-triangle-top" aria-hidden="true"></span> <span *ngIf="isSortedByMeDesc" class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span> </a>

当我检查没有颜色属性的元素时,我尝试在运行时在模板中给出颜色。

这是 stackblitz 链接:stackblitz Application

标签: cssangulardatatable

解决方案


通过在 style.css 中添加以下代码,我们可以覆盖该属性

table > thead > tr> th > mfdefaultsorter > a { color: #ffffff !important; font-weight: bold; }


推荐阅读