fischerm
07-20-2007, 07:39 PM
I came across an interesting article today and learned something new that I thought I would share with the broader community.
The article in question was on A List Apart, about conflicting positioning of CSS elements (http://www.alistapart.com/articles/conflictingabsolutepositions), with IE 5/6 thrown into the mix. It turns out, that there's a nifty non-standard feature (http://msdn2.microsoft.com/en-us/library/ms537512.aspx) of IE that allows you to toss in all that IE only CSS you usually need to make things work in IE 5/6 especially, less so with 7.
Microsoft basically uses a regular HTML comment in a unique way. Normal comments look like:
<!-- No one will see this! -->
IE uses this syntax to hide CSS, or really anything, from non-IE browsers, and from only certain versions of IE.
<!--[if expression]> HTML <![endif]-->
To normal standards compliant browsers, this simply looks like all one comment, but IE will evaluate the IF expression, and optionally include or not the expressions within.
Anyhow, I did not know that, so I just had to share!
The article in question was on A List Apart, about conflicting positioning of CSS elements (http://www.alistapart.com/articles/conflictingabsolutepositions), with IE 5/6 thrown into the mix. It turns out, that there's a nifty non-standard feature (http://msdn2.microsoft.com/en-us/library/ms537512.aspx) of IE that allows you to toss in all that IE only CSS you usually need to make things work in IE 5/6 especially, less so with 7.
Microsoft basically uses a regular HTML comment in a unique way. Normal comments look like:
<!-- No one will see this! -->
IE uses this syntax to hide CSS, or really anything, from non-IE browsers, and from only certain versions of IE.
<!--[if expression]> HTML <![endif]-->
To normal standards compliant browsers, this simply looks like all one comment, but IE will evaluate the IF expression, and optionally include or not the expressions within.
Anyhow, I did not know that, so I just had to share!