Ignoring All Styles

Album Cover: Begin To Hope

"On the radio, you hear November Rain. That solo's awful long, but it's a good refrain."
Regina Spektor / On The Radio

Posted on February 18, 2004 12:34 AM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

While working on a web application project tonight, I stumbled upon what I think is a weakness of CSS – the inability to force an HTML element to ignore all style rules that would normally be applied to it.

Part of the web application requires that some user defined HTML be stored in a database and, at times, be output as actual HTML in a page. In some cases, this HTML is output as a subset of a parent HTML document, simply for viewing purposes. When this is the case, the style rules for the parent document get applied to the HTML subset. In my eyes, this is undesirable, as I would like the subset to sit in it's own special <div> and have no styles associated with it (so that it appears as it might when existing as an entity on its own).

After Googling on the subject of ignoring CSS rules, I came to the conclusion that telling a child element of a web page to ignore all style rules in the document is not currently possible. It's possible that I'm wrong (and I hope I am), but based on the lack of any information it's the only conclusion I can come to.

It seems like under certain circumstances (like the one I've mentioned here in this post), a user should be able to create a <div> in which none of the parent document's style rules are applied, using something like the following:

<div style="inherit: none;">

Now I realize that looks a little backward to anyone who knows their CSS, but it's just an example to convey my idea. In my opinion, whenever a UA rendered this type of element, it would use its default style rules (ignoring any that had been established via any external stylesheets, inline style rules, etc.).

If anyone knows of a way of accomplishing this feat using current CSS techniques, please leave a comment. I'd love to know how it's done.


No one has added any comments.

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.