p-table with alternate row color

UI Components for Angular
Post Reply
prasadae
Posts: 1
Joined: 01 Oct 2021, 19:46

01 Oct 2021, 20:03

How to make p-table row with alternate colors... currently, Its all showing same background color that is not giving clear readability.

poyrazus
Posts: 6
Joined: 11 Mar 2021, 12:18

12 Oct 2021, 11:10

You can use nth-child css selector for that (with odd or even parameter). For example, you can put the following in your styles.css to make the background of even rows red:

Code: Select all

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

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests