Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Making a site appear differently in Firefox and IE

    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.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by abduraooft View Post
    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
    Code:
    <!--[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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Why can't they use conditional comments along with downlevel-revealed conditional commnts?
    Yeah.. a slight misread of the original post. Apologies....
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    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.

  • #6
    LSJ
    LSJ is offline
    New to the CF scene
    Join Date
    Oct 2008
    Location
    San Diego
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Easy way to do browser specific CSS

    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/

  • #7
    Regular Coder
    Join Date
    Jan 2008
    Location
    Willow Grove, PA
    Posts
    169
    Thanks
    1
    Thanked 27 Times in 27 Posts
    Quote Originally Posted by drhowarddrfine View Post
    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

    IE sees the red lines:

    Code:
    <!--[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.
    Code:
    <!--[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.
    Last edited by sobrien79; 05-19-2009 at 06:48 PM.

  • #8
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    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.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by drhowarddrfine View Post
    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/archiv...onal_comments/
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    Senior Coder
    Join Date
    Oct 2005
    Posts
    1,340
    Thanks
    0
    Thanked 61 Times in 60 Posts
    Ok, I get it now. I didn't notice the slight twist to the syntax.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •