angular - 无法为奇数行和偶数行设置单独的颜色

标签 angular css typescript ngx-datatable

这里我正在尝试我正在使用 ngx-datatable 显示一个动态生成的表,但我试图显示的是奇数行我想显示一种颜色,而偶数行我尝试应用第 n 个元素 &

body .datatable-body-row .datatable-row-even {
    background: orange;
}



body datatable-body-row .datatable-row-odd {
    background: aqua;
   } 



   .ngx-datatable.bootstrap .datatable-body .datatable-body-row.datatable-row-even {
    background-color: red;
}

我尝试了所有这些来为奇数行或偶数行设置行颜色,但这些样式不适用

最佳答案

尝试直接使用类名,如下所示:

.datatable-row-even {
    background-color: red;
}

.datatable-row-odd {
    background-color: blue;
} 

它对我有用:Stackblitz Demo

关于angular - 无法为奇数行和偶数行设置单独的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51523709/

相关文章:

javascript - 将元素 append 到 QueryList Angular

单个序列中的 Angular、ngrx/store、store select 和异步调用

angular - 有没有办法让 html 页面在从 ionic 存储中检索数据后加载?

Angular 6 StaticInjectorError : No provider for Options

javascript - Google Plus 计数器动画是如何工作的?

javascript - 切换点击功能时隐藏ID,再次切换功能时显示?

node.js - 在 Typescript 中导入 npm 包

javascript - Angular -cli : How can I access images outside of the assets folder

angular - 使用 Angular 2 的 TestComponentBuilder 让我感到困惑

javascript - 固定标题 - 向下滚动时停止动画,停止滚动时继续