IE conditional statements in Orchard?

Topics: Customizing Orchard, Writing themes
Nov 30, 2011 at 2:42 PM

How do include an specific style sheet for the awful browser that is IE?

This works in non Orchard:

<!--[if IE]>
<link rel="stylesheet" type="text/css" href="IE.css" />


This doesn't:

    <!--[if IE]>   



Nov 30, 2011 at 4:38 PM

The problem is that Style.Include pushes a style link into the header, in other words it doesn't render in place - but your conditional comments do. So if you look at the HTML source of your page output, you'll see there's just an empty conditional tag.

I saw a comment somewhere from one of the Orchard devs about properly supporting conditionals in the future.

Until then you'll just have to override Document.cshtml and place the conditional and style link manually in the header yourself.

Nov 30, 2011 at 5:20 PM

The resource management does support conditions, so this should work:


Nov 30, 2011 at 7:30 PM

Thanks guys!