I have a large table with alternating rows. Within one of the td values in the rows is a nested table. I want to match the colors of the nested tables with the corresponding row. So if the first row is a blue row and the second row is a white row, I would like the table within the blue row to be blue while the table in the white row to be white.
I've looked at a few posts on the forum referencing the nth-child(number) selector. However, I always see this selector with corresponding rows. I've tried implementing it with table and table bodies but with no luck. Here is what I've tried.
.table.unstyled table:nth-child(n) tbody tr td
:border none
:background-color blue
.table.unstyled table tbody:nth-child(n) tr td
:border none
:background-color blue
So far I haven't had much luck but I was wondering if there was a way to grab the table itself and change the background color? By the way I am using Sass.
-----EDIT--------
This is some pseudo code of what I'm trying to do. I'm working on a large application so it can be confusing. Here goes:
<table>
<thead>
<tr>
<th> Name
<th> Date
<th> Email
<th> Address
<th> Gender
<tbody>
-a ruby loop that goes through a bunch of items-
<tr>
<td> Name Stats
<td> Date Stats
<td> Email Stats
<td> Address Stats
<td>
<table>
<tbody>
<tr>
<td> Some gender stats
<td> Even gender more stats
<tr>
<td> Other gender Stuff
<td> Even more gender Stuff
That's my pseudo code. The first row created is a grey row, the second is white, repeat and repeat. What I need is to grab the table under gender stats to match the color of the respective row that it is in. What I have now is the first row of the nested table is grey and the second is white. I need the entire table to be grey or white. Does that help?
----EDIT----
Just in case this is still unclear. Please refer to this screenshot.
See how the nested table within these rows are themselves alternately striped. I need the nested table in the first row to be grey while the second table is white matching its respective row. Help would be appreciated.