[X]

Hiding CSS From Netscape 4

layout hacks 1998 partly

An import statement used as a browser filter, because Netscape 4 could not read them.

In 2026: Still valid CSS and still works, though there is nothing left to hide from. Netscape 4 applied stylesheets badly enough that hiding them entirely produced a better page than letting it try.

Where it came from: Widely used from about 1998. Documented in the Web Standards Project's Netscape 4 upgrade campaign, 2001. Wikipedia

<!-- Netscape 4 reads this and applies the basics -->
<link rel="stylesheet" type="text/css" href="basic.css">

<!-- Netscape 4 cannot parse @import, so it never sees this one -->
<style type="text/css">
  @import url("modern.css");
</style>

<!-- The other half of the trick: comment wrapping, for Netscape 2 -->
<style type="text/css">
<!--
  body { background: #fff }
-->
</style>
sandboxed demo · breaks nothing but itselfrestart

More in layout hacks

all 20 in layout hacks › · the whole library ›