Tutorials

Conditional IE Comments (to detect IE browser / IE browser version)

Code:
<!--[if IE 6]>
Internet Explorer 6
<![endif]-->

<!--[if IE 7]>
Internet Explorer 7
<![endif]-->


<!--[if lt IE 7]>
A version of Internet Explorer which is older than 7
<![endif]-->

<!--[if gt IE 6]>
A version of Internet Explorer which is newer than 6
<![endif]-->

<!--[if gte IE 7]>
A version of Internet Explorer which is 7 and above (IE 7, IE 8, etc)
<![endif]-->

Usage:
These comments can be put inside <head> section to load appropriate css/javascript files or inside <body> to display appropriate text.

Example:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/style-ie.css" />
<![endif]-->

The above code ensures that style-ie.css file (css override for IE) is loaded only for IE browsers.

One thought on “Conditional IE Comments (to detect IE browser / IE browser version)

  1. установка настенного газового котла says:

    ценно , отзывы отстой

Comments are closed.

Twitter
LinkedIn
YouTube
Instagram