DiscoDude
DiscoDude

Reputation: 617

MVC 3 - css is not rendering

This is my fault because I messing with two css files. So I deleted both css files from the content folder. Replaced it again with just one Site.css file. Updated in _Layout.cshtml file, from shared folder, like so...

<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />

So now it is not updating. Just getting plain outlook, when runnung the program. Also tried with with Site.Master in shared folder...no luck, don't know where else to look.

Any sugguestion?

Upvotes: 0

Views: 4578

Answers (4)

Rodney Willis
Rodney Willis

Reputation: 273

Make sure the reference to your stylesheet starts with the tilde character. For example:

<link href="~/Content/bootstrap.min.css" rel="stylesheet">

If you don't specify the leading "~/", then the server won't be able to find the CSS file when you reference a page directly. For example, wwww.myserver.com/Home/Index won't work, but www.myserver.com will.

Upvotes: 0

AL-Tamimi
AL-Tamimi

Reputation: 682

This is a permission issue: Please give permissions to: IIS_USR and IUSR to your website folder. It will fix the problem.

Upvotes: 0

Randall311
Randall311

Reputation: 31

I had a similar issue tonight and I found that even though my Content\Site.css file did start with a capital "S", in my layout I had to use a lower "s" (Content\site.css) for my stylesheet to show up properly in IE. In Chrome it worked fine either way.

Upvotes: 1

DiscoDude
DiscoDude

Reputation: 617

I think I removed _ViewStart.cshtml in views folder. So I created one and its seems to solve the problem.

Upvotes: 1

Related Questions