我有Index.cshtml
文件,我想在其中包括login.css
文件。Index.cshtml位于Views/Home
。我在login.css
文件Views/Home/css
夹中创建了文件。这是我如何在Index.cshtml上链接它:
<link href="css/login.css" rel="stylesheet" type="text/css">
但这是行不通的。当我在其中编写样式时Index.cshtml
,它可以完美工作。我在哪里弄错了?
通常,您不会将CSS放在“视图”文件夹中。这将属于网站项目(wwwroot)的根目录。这样,您将像这样引用您的外部样式:
<link href="~/css/login.css" rel="stylesheet" type="text/css">
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句