19 Feb, 2009
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.
Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Other similar posts that you might be interested in:
- How to use Google Fonts in your WordPress Theme
- Making a website iPhone-friendly using CSS
- Browser Market Share (Year 2009)
- MutipleIE – Install multiple versions of IE on one computer
- Some simple but effective CSS rules for IE 6
- 10 Useful jQuery Snippets
- How to use hi-res images in web apps for iPhone4
Hello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more 


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