[thelist] Cool CSS hack & a new IE 6 feature

Beau Hartshorne beau at cubeinc.ca
Mon Sep 24 20:53:05 CDT 2001


Hey, I don't know if this hack has been mentioned on thelist before, but
I think it's pretty cool. When you visit http://www.bluerobot.com/, I
always notice a few seconds of completely unstyled mark-up for before
the styled mark-up shows up. This is because that site uses the @import
tag to import its style sheet. Well check this out:

<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css" media="screen">@import "style2.css";</style>

You create two style sheets. One that Netscape 4 et al can understand,
and another that adds or extends the existing styles. There's no
javascript browser detection, it should just work.

And here's an interesting post from the
microsoft.public.windows.inetexplorer.ie6.browser newsgroup. I ran into
this "feature", and had to add some code to some of my sites:

<snip>
Asbjørn Ulsberg writes:

> This has probably already been said, but when a DOCTYPE has
> a specified URL for a DTD, IE6 somehow thinks that the
> HTML-attribute align="center" should be inherited to child-
> elements. This is of course wrong - a bug.

Tom Gilder replies:

No, it's correct behaviour according to the W3C.

Just because no other browser follows the rules for text align
inheritance, doesn't mean IE6 is incorrect.
</snip>

To solve this problem, you have to change:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
        "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">

To:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

A less hack-ish solution is to assign align="left" to every single <td>
tag that is contained in something that has been align="center"ed.

Sorry if this is old news, but I don't usually get a chance to read each
topic that goes through the list -- I hope I've helped someone out.

Cheers,

Beau





More information about the thelist mailing list