gpt4 book ai didi

c# - 为 MVC 中的特定 View 使用特定的 CSS

转载 作者:行者123 更新时间:2023-11-28 08:16:18 25 4
gpt4 key购买 nike

如何将特定的 css 文件仅用于一个特定的 View ,以便网站的其余部分使用 Site.css 而一个特定的 View 使用我的 Custom.css 文件?

最佳答案

在 View 开始的代码块中,将布局变量声明为不同的源路径,即:

@{
ViewBag.Title = "About"; //This is the about page
Layout = "~/Views/Shared/_AboutLayout.cshtml";
}

关于c# - 为 MVC 中的特定 View 使用特定的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28972581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com