Previous Message
Next Message

How do you feed IE versions different css than w3c compliant browsers?

Sent by Bill Brown on 16 April 2008 01:01


John Griessen wrote:
> Thierry Koblentz wrote:
>> <!--[if !IE]>
>> ... anything at all, including css here
>> <![endif]-->
> This short one looks good...  As I understand this, it goes in default.css, so what else besides
css code
> would you want to put here?

John:

Wrong! It does NOT go in default.css. It is an HTML comment tag...so it 
goes in your HTML source.

And the one you've commented above would not work! It would hide 
whatever you put in there from ALL browsers. Think of conditional 
comments as reverse comments...rather than hiding things from browsers, 
we choose to show something to a particular browser.

Like this:

<!--[if !IE]><-->
<h1>Anything in this block is shown to any non-IE browser.</h1>
<!--><![endif]-->

<!--[if IE]>
<h1>Anything in this block is shown to any IE browser.</h1>
<![endif]-->

<!--[if IE 7]>
<h1>Anything in this block is shown to the IE7 browser.</h1>
<![endif]-->

<!--[if lt IE 7]>
<h1>
   Anything in this block is shown to any IE browser
   older than IE 7.
</h1>
<![endif]-->

<!--[if lt IE 6]>
<h1>
   Anything in this block is shown to any IE browser
   older than or equal to IE 6.
</h1>
<![endif]-->

and so on...

So you can see how the above could also be used for this:

<!--[if !IE]><-->
<link rel="stylesheet" type="text/css" media="screen,projection"
       href="path/to/non/msie/stylesheet.css">
<!--><![endif]-->

<!--[if IE]>
<link rel="stylesheet" type="text/css" media="screen,projection"
       href="path/to/all/msie/stylesheet.css">
<![endif]-->

or this:

<!--[if !IE]><-->
<h1>
   Thanks for not using Internet Explorer.
   You make the world a better place.
</h1>
<!--><![endif]-->

<!--[if IE]>
<h1>
   Still using Internet Explorer?
   Have you considered the agony this causes
   to internet technologists?
</h1>
<![endif]-->

That make sense?
Bill
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: