- How to provide IE only style sheets. | Blog

Blog Section

How to provide IE only style sheets.

on .

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”>
<![endif]-->

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”>
<![endif]-->

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”>
<![endif]-->
<!--[if IE 7]>
<link rel=”stylesheet” href=”css/ie_7.css” type=”text/css”>
<![endif]-->
<!--[if IE 8]>
<link rel=”stylesheet” href=”css/ie_8.css” type=”text/css”>
<![endif]-->

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

Related Articles

Services Pricing

Services Pricing

Request a Free Quote

Email an Enquiry