Ⓙⓐⓚⓔ wrote:
> sure looks right! IE is disgusting, as so are conditional comments! I
> prefer to kludge IE all at once in an if ($.browser.msie) block , and
> even load in a different style sheet for those crazy browsers! I read
> a way that IE naturally ignores some css (without conditional
> comments) that a new compliant IE might obey! Perhaps an IE guru can
> shed more info here.
That is true to some extend. IE 6 does not support advanced CSS 2
selectors. That means you can easily exclude rules from IE 6 by using these:
body>div {
/* declarations not seen by IE 6 */
}
Note that you mustn't put white space into that selector like "body >
div" as some IE 5 versions will interpret everything after the
combinator ">", e.g. it would apply the declarations to all divs in this
example.
This is what I call a bad hack, because it is not future proof. Such
hacks have been used a lot, but obviously caused a lot of problems when
IE 7 came out which supports these CSS 2 selectors and suddenly applied
the styles meant to be excluded from it. *Don't do it!*
Conditional Comments may seem ugly but are the by far safest way to
serve IE specific styles. The propability that Opera will implement CC
and then let "if IE" evaluate to true goes against negative infinity.
I usually use one single IE style sheet included via CC and than hack a
little bit in that one if I need to address IE 7 or 6 solely.
For IE 7 I can than use advanced CSS 2 selectors like the one above. For
IE 6 you can use the underscore hack ("_height: 300px") or the Star
Selector Hack, which is not understood by IE 7 running in Standards Mode.
For example to achieve automatic clearing I use:
.somethingWithFloatsInside {
display: inline-block; /* @ IE 7 */
_height: 1%; /* @ IE 6 */
}
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/