Previous Message
Next Message

Re: [css-d] Hiding elements from only Netscape 4

Sent by John Lewis on 9 January 2003 03:03


Marshall wrote on Wednesday, January 8, 2003 at 8:04:53 PM:

> I recently tried to hide my text-sizer from only Netscape 4.
> Basically, I had to <link> a stylesheet that hides the .textSize
> div/span (doesn't matter which is used) and then @import a
> stylesheet that sets it back to display: block. While this makes
> sense, there's a little quirk.

> <link>'d stylesheet:

>    @import url("imported.css");
>    .textSize { display: none; };

> @import'd stylesheet:

>    body .textSize { display: block; };

> If you don't include the "body" (or any other containing element) in
> the @import, it doesn't work and the element is hidden in all
> browsers. Why is this?

The 'C' in CSS. The display:block comes before the display:none (even
though it's imported). In a sense, once the style sheet is imported,
your linked style sheet becomes this:

  .textSize{display:block}
  .textSize{display:none}

And now it's obvious why the element is not displayed.

-- 
John
Previous Message
Next Message

Message thread: