0

Almost solution I found was using javascript/jquery while on my part it should be Views in MVC. One reference is here

So I set up my css files in this way:

@{
ViewBag.Stylesheets = new string[] {
    "global/style.css",
    "global/links.css",
    .
    .
    .
    . 40 plus more css files...
};  

And load them:

@foreach (string stylesheet in
ViewBag.Stylesheets is string[] ? ViewBag.Stylesheets : new string[] { @"style.css" })
{ 
    <link href="@Url.ContentArea("~/css/" + stylesheet)" rel="stylesheet" />
}  

All of these were inside views. I have 48 css files and I notice that IE9 loads only 37 css files. For now it is not possible to combine css codes in some number of files for certain reasons. So how can I load all of these css files in IE?

2 Answers 2

3

Internet Explorer has a limit of 31 CSS files per page. This limitation has been removed in IE 10.

So you have 2 possibilities if you need to support IE <= 9:

  1. reorganize your CSS rules so that you have less than 31 files
  2. combine them (recommended)
Sign up to request clarification or add additional context in comments.

Comments

0

The ~ is unneeded. You can just have href="/css/file.css"

1 Comment

Sure, I will remove that. But still, IE doesn't load all of my css files. But no problem in Chrome or Firefox.

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.