Reputation: 555
I'd like to remove the css from a single table in a page where all other tables are defined with css (and need to be). How can i circumvent the css rules for a specific single table for an html/php page?
Upvotes: 0
Views: 660
Reputation: 61
you can check out how the css rules define in your page
if the rule defined like: '.targetTable'{} (by class) or '#tableId'{} (by id)
it would be easy to remove the css rule by changing the table class/id on html code
else if it defined like: 'table{}' (by object)
Method 1:use jquery to reset the table(which you want to use other style) css
Method 2:change the css rule by using class or id selector
Upvotes: 1
Reputation: 16884
Given your defaults:
table {
margin: 0,
padding: 0,
border: 1px solid
}
When you want to have one table that goes against that rule, you could just add a css class to that instance and override the defaults:
<table><tr><td>Default Style</td></tr></table>
<table class="i-am-special"><tr><td>Special Style</td></tr></table>
Just use this css:
table.i-am-special {
margin: 5px;
border: 2px dotted;
}
You can reset/adjust as many or as little properties as you like in your "i-am-special" class.
Note also that it doesn't have to be "table.i-am-special" if the style can be applied to other things, that's just an example.
Upvotes: 1