html.dark-side-developer

Sunday, June 12, 2005

What are IE Contitional Comments?

The IE Conditional Comments IE Conditional Comments IE Conditional Comments are a Microsoft feature built into MS Internet Explorer versions 5.0 and higher on Windows operating systems. They allow you to include code targeted at browser specific versions. Using this technique to serve curative style rules to Internet Explorer allows your main style sheet to remain clean and devoid of hacks.

The IE Conditional comment contains syntax similar to a normal html comment and a conditional filter that describes which version of IE should read the code inside of the filter. The filter consists of an if or other conditional logic statement that checks the version vector enclosed within brackets. The version vector describes the version, or multiple versions, of IE to be targeted.

Sintaxis:


<!--[if (conditional) IE (version)]>
HTML within the comment to be displayed in IE
<![endif]-->


Example:

This IE filter, <!--[if IE 5]>, targets all versions of Internet Explorer from 5.0-5.99, but not version 6.0 and higher.

This IE filter, < !--[if gte IE 5.5]>, targets all versions of Internet Explorer from 5.50 and higher, including version 6 (gte means greater than or equal to)..



Now JavaScript is not required for detect if our browser is IE. The IE conditional comments are usefull only if our HTML web page will be shown in Internet Explorer.

What are IE Contitional Comments?

The IE Conditional Comments IE Conditional Comments IE Conditional Comments are a Microsoft feature built into MS Internet Explorer versions 5.0 and higher on Windows operating systems. They allow you to include code targeted at browser specific versions. Using this technique to serve curative style rules to Internet Explorer allows your main style sheet to remain clean and devoid of hacks.

The IE Conditional comment contains syntax similar to a normal html comment and a conditional filter that describes which version of IE should read the code inside of the filter. The filter consists of an if or other conditional logic statement that checks the version vector enclosed within brackets. The version vector describes the version, or multiple versions, of IE to be targeted.

Sintaxis:


<!--[if (conditional) IE (version)]>
HTML within the comment to be displayed in IE
<![endif]-->


Example:

This IE filter, <!--[if IE 5]>, targets all versions of Internet Explorer from 5.0-5.99, but not version 6.0 and higher.

This IE filter, < !--[if gte IE 5.5]>, targets all versions of Internet Explorer from 5.50 and higher, including version 6 (gte means greater than or equal to)..



Now JavaScript is not required for detect if our browser is IE. The IE conditional comments are usefull only if our HTML web page will be shown in Internet Explorer.