[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 Wayback: WaSP upgrade

<!-- 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>

<p style="font:13px Verdana">Netscape 4 loaded basic.css and never saw the
@import. Neither file exists in this demo, so this text is plain either way:
the exhibit is the filter, not the paint.</p>
sandboxed demo · breaks nothing but itselfrestart

More in layout hacks

view the whole library ›