@import hack (was Re: [thelist] Form CSS styles)

Andrew Clover and at doxdesk.com
Thu Jan 17 12:32:02 CST 2002


maurice <maurice at graciebarra.be> wrote:

> Are you using 2 stylesheets and disabling one only for nn4 by using
> #n4 { displa\y: inherit; }?

Yes, that's a possibility. When Netscape sees the escape it throws away
that stylesheet, but not any other stylesheets linked to by the same
document.

> Does it work withl ALL versions of nn4.X?

Now that I can't tell you. It works with 4.73 and 4.78 - other versions
I haven't played with.

> And what excactly don't you like about using @import?

I just don't like the idea of embedding one language in another; it's
easiest for everyone if styles stay in a stylesheet and executable code(*)
stays in a script. Each parser only has to understand one language then
(makes syntax highlighting for text editors better, for one thing). There
are some practical issues with embedding in XHTML for related reasons - to
include '&' or '<' in your code you have to escape them or use a CDATA
section, neither of which are compatible with pre-XML HTML. The <!-- -->
hack to hide embedded content from pre-HTML 3.2 browsers also fails in
XHTML. (I've posted a workaround for these before but it's not pretty.)

I don't think the @import trick is especially bad, I just prefer doing it
the other way. And using @import in one stylesheet to link to a second
one is also fine, since it doesn't involve mixing languages.

* - I include event handlers in this. DOM-style events mean never having
    to write 'onmouseover' again. Which is nice.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://and.doxdesk.com/




More information about the thelist mailing list