Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a css rule for all elements except one class?

People also ask

How do I select all child elements except one in CSS?

To select all the children of an element except the last child, use :not and :last-child pseudo classes.

How do I apply CSS to all elements?

The * selector selects all elements. The * selector can also select all elements inside another element (See "More Examples").

Can you assign multiple CSS rules to an element?

When you group CSS selectors, you apply the same styles to several different elements without repeating the styles in your stylesheet. Instead of having two, three, or more CSS rules that do the same thing (set the color of something to red, for example), you use a single CSS rule that accomplishes the same thing.


The negation pseudo-class seems to be what you are looking for.

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

It's not supported by ≤ IE8 though.


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?


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.