Results 1 to 5 of 5

Thread: diff css file for IE

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default diff css file for IE

    i am working on a small project...

    using CSS for styles,

    my all styles are working on all the browsers, but some fails on IE browsers, so i created a diff file for IE browsers,
    i want to ask that i need to mention all the styles in IE file or only those styles , which doesnot work on IE ?


    means there are 200 styles in css file but only 5 are not working in IE,
    so should i defin only 5 in IE'css file or all the 200 styles?
    give suggestion?

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Define only the 5 and put them after the first declaration of the css in the appropriate conditional statement.

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    ^ I would take that explanation a little further and say that your ie.css (inside its conditional comment) should be the last css file you link to. This insures that your IE-only rules won't be accidentally overridden by a subsequent stylesheet.

    for example, if you have #contentbox{ height: 1%; } in your ie.css and a later stylesheet has #contentbox{ height: auto; }, it will break your Holly Hack. However, if your ie.css comes last, it will override the "height: auto" setting in the other stylesheet and everything will work as intended.
    Last edited by traq; 11-17-2009 at 05:52 AM.

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Yea, that's what i meant by after your first css declaration, I assumed linked style sheets were being used.
    Code:
    <link rel="stylesheet" type="text/css" href="location.css" />
    condtion you want
    <link rel="stylesheet" type="text/css" href="IE_location.css" />
    end condition

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I figured that's what you meant, but was concerned it could be interpreted simply as "second":
    Code:
    <link rel="stylesheet" type="text/css" href="location.css" />
    condtion you want
    <link rel="stylesheet" type="text/css" href="IE_location.css" />
    end condition
    <link rel="stylesheet" type="text/css" href="other_location.css" />

Bookmarks

Posting Permissions

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