...

View Full Version : Making a site appear differently in Firefox and IE



Deadbeat007
05-19-2009, 02:43 AM
Hi guys,

I got my site to look good in Firefox, my preferred browser, but the spacing is all mashed up in IE. Is there any script or code that will use a different style.css in the instance of a viewer using IE? I've seen this done before, but I can't remember how. It would help a ton if I could have two .css's: one for Firefox and one for IE.

Thanks.

abduraooft
05-19-2009, 08:34 AM
Is there any script or code that will use a different style.css in the instance of a viewer using IE? I've seen this done before, but I can't remember how. It would help a ton if I could have two .css's: one for Firefox and one for IE. There is no such shortcut CSS for your purpose. A css used in one site can not be used as such in another one, unless one is the clone of another one.

Can we have a link to your page so that we can analyse the issues based on your description.

_Aerospace_Eng_
05-19-2009, 08:49 AM
There is no such shortcut CSS for your purpose. A css used in one site can not be used as such in another one, unless one is the clone of another one.

Can we have a link to your page so that we can analyse the issues based on your description.

Why can't they use conditional comments along with downlevel-revealed conditional commnts?

The below will display the style.css for any browser except IE, and display iestyle.css for only IE

<!--[if !IE]>-->
<link rel="stylesheet" href="style.css" type="text/css">
<!--<![endif]-->
<!--[if IE]>
<link rel="stylesheet" href="iestyle.css" type="text/css">
<![endif]-->
However its likely you can just use a conditional comment to make things look properly in IE while still giving it the normal stylesheet. Post your code. A link is preferred.

abduraooft
05-19-2009, 09:07 AM
Why can't they use conditional comments along with downlevel-revealed conditional commnts? Yeah.. a slight misread of the original post. Apologies....

drhowarddrfine
05-19-2009, 02:59 PM
Unless something has changed that I don't know about, there is no such thing as !IE (not IE). Conditional comments are IE only and no other browser recognizes them so you can't use them to send anything to other browsers.

LSJ
05-19-2009, 05:44 PM
This is a script by Rafael Lima allows you to target specific browsers and / or operating systems from a single stylesheet. LOVE IT!

http://rafael.adm.br/css_browser_selector/

sobrien79
05-19-2009, 06:46 PM
Unless something has changed that I don't know about, there is no such thing as !IE (not IE). Conditional comments are IE only and no other browser recognizes them so you can't use them to send anything to other browsers.

There is the ! operator. Microsoft MSDN on Conditional Comments (http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx)

IE sees the red lines:



<!--[if !IE]>-->
<link rel="stylesheet" href="style.css" type="text/css">
<!--<![endif]-->
<!--[if IE]>
<link rel="stylesheet" href="iestyle.css" type="text/css">
<![endif]-->


All other browsers see the green line. Everything else is considered a comment line.


<!--[if !IE]>-->
<link rel="stylesheet" href="style.css" type="text/css">
<!--<![endif]-->
<!--[if IE]>
<link rel="stylesheet" href="iestyle.css" type="text/css">
<![endif]-->


It's an effective way of including a css file that you don't want IE to render. Rather than the usual way of including a css file that you only want IE to render.

drhowarddrfine
05-19-2009, 07:13 PM
But you are presuming Firefox recognizes the !IE comment. Firefox, and all other browsers I think, do not recognize conditional comments, so who is the !IE statement for? In the example link to MSDN, that won't work either.

_Aerospace_Eng_
05-19-2009, 08:31 PM
But you are presuming Firefox recognizes the !IE comment. Firefox, and all other browsers I think, do not recognize conditional comments, so who is the !IE statement for? In the example link to MSDN, that won't work either.

http://www.456bereastreet.com/archive/200511/valid_downlevelrevealed_conditional_comments/

drhowarddrfine
05-19-2009, 09:02 PM
Ok, I get it now. I didn't notice the slight twist to the syntax.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum