Published on: 15 July, 2013

How to target CSS for internet explorer use only?

Tumblr Digg Google Plus

Sometimes you realize your current website is not rendered properly in Internet Explorer browser. As there are many version of IE, you can specifically target for each version by using a very simple html tag if condition.

The following example code, will target exactly the specific version of IE.

<!--[if IE 6]> <link href="ie6.css" type="text/css" rel="stylesheet"/> <![endif]-->
<!--[if IE 7]> <link href="ie7.css" type="text/css" rel="stylesheet"/> <![endif]-->
<!--[if IE 8]> <link href="ie8.css" type="text/css" rel="stylesheet"/> <![endif]-->
<!--[if IE 9]> <link href="ie9.css" type="text/css" rel="stylesheet"/> <![endif]-->

Here is another example to target any IE version under 9.

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

Remember when designing a website, always check it against all browsers, most used browsers are firefox and chrome, followed by The Internet Explorer.

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.