More Methods

by Andrew Clover

  1. 'element#id' selectors

    This can be used to hide from Netscape 4 ONLY. I often use the form "body#notn4 .realrule" when I want a rule which can't be expressed in the form 'element#id'. However this workaround also triggers:

  2. '#id child' selectors

    Containment inside an #id mysteriously fails on Amaya ONLY. I don't normally bother trying to workaround issues in Amaya though, since it's not even close to a production browser.

  3. CSS '\' escapes in selectors

    This can be used to hide from N4, IE/Win up to at least 5, Opera up to 5.11. The only browsers I've seen which understand CSS escapes are Mozilla and Amaya - would be interested to know if IE5/Mac works. I sometimes use the form "bod\y .realrule" (you can't escape any old character as 0-9A-Fa-f are interpreted as character code escapes).

by Juan R. Pozo

I discovered one hack for Opera Win 6.0, 5.12, 5.11, 5.02 (IIRC) & Opera Win 3.62 (don't know about 4.0). Just specify media="scReen" instead of media="screen"

You can see a demo at: http://html.conclase.net/pruebas/hacko5.html

by Sascha Claus

IE up to version 6 (Windows):

[class~="Klasse"]
[class~="Klasse"], .Klasse
.Klasse, [class~="Klasse"]
.Klasse, [irgendein="attribut"]

is ignored together with all declarations. I.e. with a dummy

div.navbar, [dummy]

you can make CSS-declarations invisible for IE up to and including 6 on Windows.

NN4 tolerates all possibilities without quotation marks:

.Klasse, [class~=Klasse]                  /*  also valid  */
.Klasse, [jfgju vijhjfnm%%$$5&/&&%]       /*  oops, invalid  */
.Klasse, [dummy]                          /*  valid  */

NN4 renders the declarations for "Klasse" (if he knows them :-) ). But he refuses quotation marks:

.Klasse, [class~="Klasse"]
.Klasse, ["dummy"]                       /*  invalid  */

by Caio Chassot

See Caio's comment technique at http://www.v2studio.com/k/css/n4hide/:

Use a /*/*/ comment to begin hiding from N4. All subsequent CSS will be ignored by it, because it thinks the comment didn't close. Add another comment, and N4 will get back reading the styles from this point on.

My hack at http://www.v2studio.com/k/css/n4hide/, which you list at http://pixels.pixelpark.com/~koch/hide_css_from_browsers/more/ affects Opera 5 on Mac, not only N4 as first thought.

/* Tell NS4 to ignore these styles.... */
/*/*/
.foo2 { color: red }
.foo3 { color: red }
/* Okay, we can let NS4 see the rest.... */
.foo4 { color: red }