In my _Layout.cshtml file I have the following lines
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" media="all" href="/Content/css/ie7.css" />
<![endif]-->
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" media="all" href="/Content/css/ie6.css" />
<![endif]-->
Both these lines are commented out. I've always wondered, but was too afraid to ask if commented out code like this is needed or not. In other words if I am using IE6 or IE7 will the appropriate line above become 'activated' somehow or does the simple fact that it is commented out mean that it will never get called?
These are conditional comments.
As far as HTML is concerned, they are commented out.
Internet Explorer violates the standard to ignore the comments under certain conditions (i.e. when they start with a [unless you are some version of ie]
string) so it will "activate" the code inside.
This is called browser specific conditional comments. It will choose, the stylesheet specified in the first line if you use IE 7 and the style sheet specified in the second line if you use the IE 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With