我在 MVC 架構的 Content 檔案夾下創建了一個 Site.css 樣式表,但是在向其添加樣式后,我的 VIEW 中沒有看到任何更改。我如何將它們鏈接在一起? Visual Studio VIEW 示例中的解決方案資源管理器:
@model SchoolProject.Models.Teacher
@{
ViewBag.Title = "Delete";
}
<h2>Warning: Deleting is permanent</h2>
<div>
<div>@Model.FirstName @Model.LastName</div>
</div>
<form method="POST" action="/Teacher/DeleteTeacher/@Model.Id">
<div>
<input type="submit" value="Delete" />
</div>
</form>
uj5u.com熱心網友回復:
如果您在視圖中使用布局頁面:
打開 Views->Shared->Layout.cshtml 并將 Site.css 檔案拖放到標題中。
如果您沒有在視圖中使用布局頁面,則必須將 Site.css 檔案拖放到視圖中。
uj5u.com熱心網友回復:
您可以在“BundleConfig.cs”檔案中檢查或鏈接您的 css。您可以在此處導航 App_Start>BundleConfig.cs 您可以找到鏈接您的 css 檔案的代碼
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/463259.html
標籤:C# css asp.net-mvc 视觉工作室
上一篇:RGB到V(來自HSV)
下一篇:如何從應用程式中洗掉標簽
