Skip Navigation

[Resolved] Styling borders + background colors for table view

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by kateT 4 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1877353

Tell us what you are trying to do?
I recently implemented a table view for a resources library on my site to make it easier to enter information and add custom fields (I was using a Posts Pro Table before). I would like to style my new view table to look like my earlier table by removing the borders and adding alternating colors for odd/even rows. How do I go about adding that CSS, and which classes do I use?

Is there a similar example that we can see?
New table (in need of styling): hidden link
Old table (desired style): hidden link

Thank you!!

#1877737

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You should target your row (tr) using the nth-child(even) for even row and nth-child(odd) for odd row and specify your desired color.

For example:

.view-table tr:nth-child(even) { 
background: #CCC
}
.view-table tr:nth-child(odd) {
background: #FFF
}

You can add this custom CSS to your View's custom CSS box and change your desired background color for odd/even rows as per your need.

More info:
=> hidden link

#1878215

Thanks, Minesh! That was exactly what I needed. Problem solved.