views:

347

answers:

2

Hi I'm editing a website that has been made compatable with internet explorer so it doesn't work in firefox.

Is there any way to add a firefox or mozilla stylesheet?

Thanks for you help Judi

<!--[if FIREFOX]>
    <link rel="stylesheet" type="text/css" href="/AEBP_Homepage_12887/css/firefox.css" />
<![endif]-->
A: 

No, conditional comments are entirely an Internet Explorer thing AFAIK.

However, you can create a conditional comment that IE will not parse and thus is for non-IE browsers only:

<![if !IE]>
<link rel="stylesheet" type="text/css" href="/AEBP_Homepage_12887/css/firefox.css" />
<![endif]>

this is however not valid HTML. There seem to be workarounds to make it valid. Check out the "Downlevel-Revealed conditional comment" paragraph in the Wikipedia article.

Pekka
That's invalid markup, though, right?
Joey
True, I just wondered myself (have never used it before). There's more in the Wikipedia article, I'll add a note.
Pekka
A: 

No. The <!--[if IE]><![endif]--> syntax is Internet Explorer specific. It is a non-standard microsoft extension to CSS.

See conditional comments for more details.

Oded