How to provide IE only style sheets.

For providing IE only style sheets, conditional statements allow us to do so, in an html document.

The first option is to declare IE-only style sheet inside a conditional comment that targets all versions of IE, like this:

<!–[if IE]>
<link rel=”stylesheet” href=”css/ie.css” type=”text/css”>

You can also declare it using @import directive.

For targeting IE8 and its earlier versions, you can use the following statement. The lte part of the conditional comment stands for “less than or equal to.”

<!–[if lte IE 8]>
<link rel=”stylesheet” href=”css/ie_lte8.css” type=”text/css”>

Other possible values are lt for “less than,” gte for “greater than or equal to,” and gt, used for “greater than.”

Now the another option is to use multiple conditional comments to provide a different style sheet to each version of IE you need to fix, like this:

<!–[if IE 6]>
<link rel=”stylesheet” href=”css/ie_6.css” type=”text/css”>
<!–[if IE 7]>
<link rel=”stylesheet” href=”css/ie_7.css” type=”text/css”>
<!–[if IE 8]>
<link rel=”stylesheet” href=”css/ie_8.css” type=”text/css”>

In this way, you can add IE specific stylesheets to your html document.

Related Articles

Add a Comment

Your email address will not be published. Required fields are marked *


My name is Nohman Habib and I am a web developer with over 10 years of experience, programming in Joomla, Wordpress, WHMCS, vTiger and Hybrid Apps. My plan to start is to share my experience and expertise with others. Here my basic area of focus is to post tutorials primarily on Joomla development, HTML5, CSS3 and PHP.

Nohman Habib


Request a Quote