0

I'm using a main stylesheet on a webpage which contains this CSS argument for tables:

tr:nth-child(2n) { 
   background-color:#fff;
}

I now came along an individual case with this nested structure: span > ol > li > ol > li > table > tr. How can I address the tr of the table to assign

tr { 
   background-color:none;
}

to it? I already tried

#spanclass ol li > ol li > tr { 
   background-color:none !important;
}

where "spanclass" would be the class of the span, but with no avail. This CSS construct also didn't work:

#spanclass > tr { 
   background-color:none !important;
}

Using a specific class for the mentioned tr didn't help either.

How can I solve this issue?

Thanks in advance!

Edit: This is the relevant HTML part. I replaced the original text from the page to keep it short.

<span class="spanclass">
    Lorem ipsum
    <ol type="I">
        <li>Lorem ipsum</li>
        <li>
            Lorem ipsum
            <ol type="a">
                <li>Lorem ipsum</li>
                <li>Lorem ipsum</li>
                <li>
                    Lorem ipsum
                    <div class="table-responsive">
                        <table class="w-auto mw">
                            <tr>
                                <td>Lorem ipsum</td>
                                <td>Lorem ipsum</td>
                                <td>Lorem ipsum</td>
                                <td class="td-right">Lorem ipsum</td>
                            </tr>
                            
                            <tr class="tr-bgr">
                                <td>Lorem ipsum</td>
                                <td>Lorem ipsum</td>
                                <td>Lorem ipsum</td>
                                <td class="td-right">Lorem ipsum</td>
                            </tr>
                        </table>
                    </div>
                </li>
            </ol>
        </li>
    </ol>
</span>
bear87
  • 83
  • 1
  • 11
  • You'll need to show the html – Ouroborus May 21 '22 at 10:26
  • @Ouroborus I added the HTML part in my original post. – bear87 May 21 '22 at 10:56
  • `.spanclass tr` – zer00ne May 21 '22 at 11:16
  • @zer00ne Unfortunately the background from the nth child assignment still persists when using `.spanclass tr`. – bear87 May 21 '22 at 12:42
  • @bear87 to increase [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) double or if you must triple the class like so: `.spanclass.spanclass.spanclass tr` If that fails the last resort is [`!important`](https://stackoverflow.com/questions/9245353/what-does-important-mean-in-css), and if that doesn't work then you've made a mistake or there's a simular ruleset after that ruleset that has `!important`. – zer00ne May 21 '22 at 17:22

0 Answers0