Page 1 of 1

Change color of even and odd row

Posted: 06 Jul 2020, 16:42
by devman
Hello, I am trying to change to alternating colors for even and odd rows as I find the default to not have enough contrast. I searched around but could not find a working solution.

Here is the code that I am currently trying:

Code: Select all

.p-datatable.p-datatable-odd {
    background-color:red;
    background-image: none;
}

.p-datatable.p-datatable-even {
    background-color:blue;
    background-image: none;
}
Any help is appreciated.

Re: Change color of even and odd row

Posted: 11 Oct 2020, 00:39
by mert.sincan
Hi,

Please see our striped demo; https://www.primefaces.org/primereact/s ... le/striped
To customize the colors;

Code: Select all

.p-datatable.p-datatable-striped .p-datatable-tbody > tr:nth-child(even) {
    background: #fcfcfc;
}

.p-datatable .p-datatable-tbody > tr {
    background: #ffffff;
}
Best Regards,