tags:

views:

29

answers:

2

Is there a fast way in CSS to remove all of the styles applied to an element? For example, say a tab menu of some sort:

<div class='outer'>
  <div id='d1'></div>
  <div id='d2'></div>
  <div id='d3'></div>
  <div id='d4'></div>
</div>

The CSS is applied...

.outer { foo:blee; bar:blah; bas-bloo:snork; /*...long long list...*/ }

Now, I want #d3 (for example) to return to default styling, but I don't want to explicitly unset all of the parent styles:

#d3 { remove-styles:all } /* <- [I made this up, obviously] */

Pipe dream or possibility?

+1  A: 

No. Not feasibly possible. Just override it.

meder
Sorry Meder, lower rep gets the vote :s Gotta help out the little guy - he's so close to 500 also :)
Steve
It's been so long since I felt so worthy...
Isaac
+2  A: 

In CSS3, yes. You could use the negation pseudo-class:

http://www.w3.org/TR/css3-selectors/#negation

So:

.outer:not(#d3) {foo:blee; etc etc}

Too bad CSS3 support is a little lacking at the moment with most browsers...

With CSS level less than 3, you're screwed. Sorry.

Isaac
Why not just manually override it? This class seems a bit useless. Thanks though.
Steve
In this case, yes. I thought you were talking about the general case of excluding subelements from cascading styles...
Isaac