ASP MVC import CSS

痴心易碎 提交于 2019-12-14 03:58:35

问题


I am new to ASP.NET MVC and I am trying to include a CSS file into my view.

The view is strongly typed and has a List Scaffold Template, it is linked to a master page which itself is linked to a css file and works fine for the master slide but when trying to link the view to a seperate css file I cant as I cannot include tags.

Anybody know how I can resolve this?


回答1:


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



回答2:


You should add a new content place holder in your site.master page in the head tags, i always have one called "HeadContent" which i use for inclusion of scripts and css that i only want on individual pages.



来源:https://stackoverflow.com/questions/5750726/asp-mvc-import-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!