views:

63

answers:

3

Hi,

I have created a CSS stylesheet for my project. Is there any way I can create a css rule that applies to all table elements EXCEPT table elements belonging to the class "dojoxGrid"? Something like:

.not(dojoxGrid) table{
    width:100%;
    border-top:1px solid #dddddd;
    border-left:1px solid #dddddd;
    border-right:1px solid #dddddd;
    margin:1em auto;
    border-collapse:collapse;
}

Thanks in advance!

+4  A: 

Wouldn't setting a css rule for all tables, and then a subsequent one for tables where class="dojoxGrid" work? Or am I missing something?

cori
Yeah that would absolutely work, but you would be setting all those properties to a value. If you wanted to leave them "unset" then no. Presumably Nick is trying to not clobber the values for dojoxGrid as they're set elsewhere.
kibibu
I think it would. However I am setting a bunch of properties for all tables, I could again overwrite them with the default values needed for the dojoxGrid. However I am not sure what these default values are as they are generated by the dojo library. Therefore I was looking for another way to achieve it.
Nick
+1  A: 

The safest bet is to create a class on those tables and use that. Currently getting something like this to work in all major browsers is unlikely.

Joel Potter
A: 

maybe something like the not css3 selector

table:not(.dojoxGrid) {color:red;}

it's not supported by IE though

Knu
that's a nice css3 selector to be aware of - hopefully usable in IE9.
cori