At 4/10/2010 06:46 PM, Shanna Cramer wrote: >I frequently work on child themes and build custom style sheets in addition >to the parent style sheet. >Is there a way to zero out a style? Just remove any parent styling that was >applied to some element.
If we're to take your question literally, the conceptual problem with "zeroing out" an element's styles is that there isn't really a zero-state in ordinary usage. When we launch a browser, page elements are styled according to the browser's inboard stylesheet plus the user's custom stylesheet if any. I'll assume that the closest to "zero" you really want to get is to disable author stylesheets but no others. Removing all author stylesheets could be done by using server-side or client-side scripting to intercept the markup and delete or disable pertinent link and style elements on the page. However, you're asking about disabling author styling for specific elements only, so scratch that. If you're OK with your changes reaching most but not all visitors, you could write a JavaScript routine that would seek out and remove style sheet rules that specifically targetted a particular element. However, the problem is complicated by the fact that an element is often styled by rules that refer not merely to it alone but also to others with the same selector pattern (nodeName, class, or ancestry). How can we "zero" the styles for one such element and not the others? One strategy might be to programmatically change an element's nodeName, id, and/or class so as to produce a new, unique element that isn't covered by the author style sheets at all, then adding style rules for the new element. Again, this could be done by intercepting the markup either server-side or client-side, the latter reaching a majority but not the totality of visiting UAs. Since "removing" styles is so problematic, I'm guessing that you'll probably settle for the much simpler alternative of setting an element's styles to known base values such as margin: 0; padding: 0; etc. This approach does not remove author styling from the equation leaving browser and user stylesheets in place, it potentially overrides them all. One technical challenge here is how to add your zeroing-out rules with great enough specificity that they trump all other rules in the parent stylesheets. You could try to bludgeon your way through that using !important but that can wreck a lot of furniture in a roomful of nested elements. Regards, Paul __________________________ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com ______________________________________________________________________ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/