How to target CSS for internet explorer use only?

andy - 15 Jul, 2013 3107 Views 0 Comment

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.


There are no comments available.

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

Related Articles

How to style pagination links with CSS?

Do you need to create a beautiful, simple and elegant pagination links with css? Simply follow our easy and quick tutorial on how to create the pagination links easily with CSS.

Optimizing your site for printing

The easy way to optimize your site for printing is to create a separated external css targeting a media to print only When a printing action is being executed the browser will send over the information from your page to ...