Does CSS have a "start over" feature?

Posted by Rick Wayne on Stack Overflow See other posts from Stack Overflow or by Rick Wayne
Published on 2010-04-27T18:52:57Z Indexed on 2010/04/27 18:53 UTC
Read the original article Hit count: 270

Filed under:
|
|
|
|

I'm using calendar_date_select (henceforth CDS) in a Rails application, and have a stupid question. When I embed the CDS component in the middle of an already-CSS-styled page, all manner of things go ugly-wrong with it (spacing, fonts, etc.). Clearly the elements inside the CDS have inherited unwanted stuff from the styles already working in the containing page.

Now, I could use a combination of, say, Safari's CSS debugging and analyze what's wrong element-by-element. But that's (A) tedious, and (B) might load up my component's styles with tons of container-defeating special cases. If nothing else, I'm certain to change the containing page's styles in the future and would have to maintain the special cases.

My question: Is is possible to have a DIV in a page that essentially backs out all the existing styling? Is there a simple one-liner that will do this? Failing that, can it be done on an element-by-element basis?

E.g. I know what tags the CDS generates, so I could list each of them:

{ p: "#--NOTHING--#"; a: "#--NOTHING--#"; }

where #--NOTHING--# is the Magic Turn Off All Inherited Styles incantation.

http://code.google.com/p/calendardateselect/

Thanks, peeps.

© Stack Overflow or respective owner

Related posts about rails

Related posts about css