CSS Filter: Hide rule from Firefox and Mozilla

2005-01-27 11:40 - Programming

I found this by accident recently. It's quite simple, it's a CSS Filter to hide a single rule from at least Firefox and Mozilla, while WinIE6 can see it. I am unsure of effects on other browsers at this point. The filter looks like this:

selector { { declaration }

It's the second opening brace that breaks Mozilla, while IE happily ignores it.


Inline too!
2005-05-25 14:52 - arantius

I just tried this out, and you can work this with inline styles as well, i.e.:

<div style='color: green; { color: blue;'>

IE will see a div with blue text, FF green text. IE ignores the invalid character and keeps going, while FF/Mozilla stops at the curly brace. You can even go more extreme:

<div style='color: green; {IE only rules follow:} color: blue;'>

It's far from valid, but it does the job.

Post a comment:

  If you do not have an account to log in to yet, register your own account. You will not enter any personal info and need not supply an email address.

You may use Markdown syntax in the comment, but no HTML. Hints:

If you are attempting to contact me, ask me a question, etc, please send me a message through the contact form rather than posting a comment here. Thank you. (If you post a comment anyway when it should be a message to me, I'll probably just delete your comment. I don't like clutter.)