0

I'm converting a web forms application and in a code behind I see where a guy checked for IE8 browser, then displays that IE8 CSS. If I had the time I would figure out what the differences are, but for now I'm thinking that I would just like a nice clean approach in mvc 3 razor to 1. check for which browser is used ( namely IE8 ) and then display the appropriate

1 Answer 1

1

You can use a conditional tag.

<!--[if IE 8]>
    <!-- include your ie8 stylesheet here -->
<![endif]-->
Sign up to request clarification or add additional context in comments.

7 Comments

@Craig If I have a razor page with this @section Styles { <link href="@Url.Content("~/Content/default.css")" rel="stylesheet" /> } Where is a good place for your tag?
Without seeing the rest of your code, I can't say the best place, but you can use it in your section or your layout. It's standard html, nothing asp.net or mvc specific.
You're welcome. If that does it for you, please click the check to mark this as the answer. :)
Looking into these conditional statements, can there be an 'else' ?
You can't do else but you can add a second conditional tag with a NOT operator. <!--[if !IE 8]> <![endif]-->
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.