Change color of even and odd row

UI Components for React
Post Reply
devman
Posts: 4
Joined: 06 Jul 2020, 16:37

06 Jul 2020, 16:42

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.

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

11 Oct 2020, 00:39

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,

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest