当前位置: 首页 > 工具软件 > portal-stack > 使用案例 >

css in html how to,asp.net mvc - how to refere CSS in CSHTML file? - Stack Overflow

何禄
2023-12-01

In your _Layout you could have 2 sections: one for the scripts and one for the styles:

@ViewBag.Title

@RenderSection("Styles", false)

@RenderBody()

@RenderSection("Scripts", false)

and then in your view override the sections you want:

@model Portal.Common.Models.TempModel

@{

ViewBag.Title = "asdasd";

ViewBag.MissionId = id;

ViewBag.id = 0;

Layout = "~/Views/Shared/_Layout.cshtml";

}

@section Styles {

img[src*="iws3.png"] {

display: none;

}

}

@section Scripts {

// some inline javascript

}

 类似资料: