In this scope can help you.
Let suppose you have a rule in your static resource like:
thead th{ font-weight: bold; } <table> <thead> <th> Heading <!-- Your css will apply on this content only if there is no rule for this element in the salesforce css. --> </th> </thead> </table>
This can be overridden by salesforce CSS so to prevent this wrap your CSS in a scope and then wrap your elements in a wrapper and wrapper is having the top selector/scope selector you used in your CSS.
Let me clarify with an example:
Old/Current structure in static resource:
thead th{ font-weight: bold; }
After adding the scope/wrapper your CSS and HTML becomes this:
.myScope thead th{ font-weight: bold !important; /* here "!importatnt" is required if added with the salesforce CSS rules else you can leave it. */ } <table class="myScope"> <thead> <th> Heading <!-- Your css will apply on this content only if there is no rule for this element in the salesforce css. --> </th> </thead> </table>
To add scope to your CSS rules you can use online tools like SASS Compiler
Hope this solves your problem!