1

As a follow up to this question, how do I prevent Internet Explorer from loading multiple style sheets, (since I want Firefox and Chrome to load one, and IE to load the other?) Is it the order in which the references are placed, or same file names but in different folders, do I need to do an if else type of statement, or what?

For example, will IE load both given this:

<!--[if IE]>
    <link href="/Content/SiteIE.css" rel="stylesheet" type="text/css">
<![endif]-->
<link href="/Content/Site.css" rel="stylesheet" type="text/css">
Community
  • 1
  • 1
Garrett Fogerlie
  • 4,450
  • 3
  • 37
  • 56

2 Answers2

4

The complete syntax is:

<!--[if IE]>
According to the conditional comment this is IE<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<![endif]-->
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<![endif]-->
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<![endif]-->
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<![endif]-->
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<![endif]-->
<!--[if !IE]> -->
According to the conditional comment this is not IE<br />
<!-- <![endif]-->

Source: http://www.quirksmode.org/css/condcom.html

William Entriken
  • 37,208
  • 23
  • 149
  • 195
1

yes it will load both. But what i do sometimes is to make the IE specific rules have a higher specificity such that it take a higher order over other ones meant for other browsers

omoabobade
  • 515
  • 5
  • 16