html - Inherit CSS from preceding tr -
I have to change the background color of my table rows. But I have some lines (class B) which are sub-sections of classes. Basically they show that they are down in the top row. I want those lines to be in the form of a single side color as the original line in the form of their next "A" alternative back
The table is being dynamically created, so it should be flexible.
I have tried every CSS selector, but I do not know how to remove "A" background in "B"? Can anyone tell me that this is also possible or I have to reorganize HTML.
I am fine with using jQuery or Javascript to fix this.
Simple HTML:
& lt; Table & gt; & Lt; Tr square = "one" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr square = "a" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr class = "b" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr square = "a" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr square = "a" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr class = "b" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr class = "b" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; Tr square = "a" & gt; & Lt; Td> Asdf & lt; / Td> & Lt; / Tr & gt; & Lt; / Table & gt; CSS:
.a: nth-of-type (even) {background color: #DDD; } .b td {padding-left: 25px; } Bella:
Comments
Post a Comment