Forum Moderators: open
I'm thinking that most of the rendering bugs in IE7 have been fixed so it doesnt need one?
Here is what I am trying:
<link rel='stylesheet' type='text/css' href='/include/css/portal.css' title='main' />
<!--[if gte IE 5]>
<!--[if lte IE 6]>
<link rel='stylesheet' type='text/css' href='/include/css/ieportal.css' title='main' />
<![endif]-->
<![endif]-->
[edited by: DamianS at 5:43 am (utc) on May 20, 2007]
[edited by: DanA at 6:46 am (utc) on May 20, 2007]
So it would need to be something like:
<link rel='stylesheet' type='text/css' href='/include/css/portal.css' title='main' />
<!--[if IE 5]>
<link rel='stylesheet' type='text/css' href='/include/css/ie5portal.css' title='main' />
<![endif]-->
<!--[if IE 6]>
<link rel='stylesheet' type='text/css' href='/include/css/ie6portal.css' title='main' />
<![endif]-->
Yes, I'm leery about IE7 since it seems to fix most but probably not all rendering bugs. And I still have to worry about the 'hasLayout' property.
Unfortunately, I don't yet have IE7 to test it.
<!--[if lt IE 7]>
as stated previously IE4 doesn't read conditionals so this would only target 5.x/6
then you can have another for IE7
<!--[if gte IE 7]> or <!--[if IE 7]>
But IE7 does still have some crossover with IE6 re hasLayout and also it has some new stuff. So you can, if you're willing to use back compatible filters, cope with the whole lot in one conditional (until we see what IE8 might bring..)
e.g.
<!--[if lte IE 7]>
<style type="text/css" media="screen">
div {
_width: 100%; /* only ie5/6 will read this */
float: left; /* all IE's will read this */
}
</style>
<![endif]-->
inside the one sheet you can differentiate between 5/6 and 7 using the underscore hack, IE7 has fixed this parse error so will ignore the rule. So for example if you only need 5/6 to see a hasLayout fix use the underscore, but if you find it's one of those fixes that IE7 still needs to see as well, don't use an underscore.
In reverse if there's a rule that you only want IE7 to see, though I can't think of a specific example where this is the case yet, declare the rules in reverse
div {
width: 100%; /* all IE's will read - IE7's width */
_width: auto; /* overrule for IE5/6 width */
}
I'm generally not in favor of using parse hacks but because a Conditional Comment is an indicator of IE workarounds, in the first place, using a back compat hack in it along with comments as to why doesn't make much difference to me than having 2/3 CondComs.
[edited by: SuzyUK at 8:55 am (utc) on May 21, 2007]
The general advice, when using hacks is where possible to only use backward compatible hacks, ones which have already been fixed and are only required for back browser versions, their situation cannot change so they can be put there and "forgotten"
Suzy
So I thought that perhaps this wouldn't work.. but it does
div {
/* to test if hasLayout can only be triggered for IE7 in single conditional sheet */
zoom: 1;
_zoom: normal; /* yes this works to reset hasLayout to false for IE5/6 */
}<div><p>this div has, hasLayout=false (0) in IE5.5/6 and hasLayout=true (-1) in IE7</p>
<button onclick="alert(normal.currentStyle.hasLayout)">hasLayout is?</button>
</div>
again I can't think of a specific case where this might be needed but thought it would be useful to know it can be done in the single IE CSS.