开发者

CSS element back to default style

Is there a fast way in CSS t开发者_运维技巧o 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?


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

.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.


No. Not feasibly possible. Just override it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜