Log in

View Full Version : diff css file for IE



gurmeet
11-17-2009, 05:22 AM
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?

bluewalrus
11-17-2009, 05:26 AM
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/library/ms537512%28VS.85%29.aspx

traq
11-17-2009, 05:46 AM
^ 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. :)

bluewalrus
11-17-2009, 02:12 PM
Yea, that's what i meant by after your first css declaration, I assumed linked style sheets were being used.


<link rel="stylesheet" type="text/css" href="location.css" />
condtion you want
<link rel="stylesheet" type="text/css" href="IE_location.css" />
end condition

traq
11-17-2009, 03:55 PM
I figured that's what you meant, but was concerned it could be interpreted simply as "second":


<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" />