家长提问:ASP.net MVC navbar-brand to header text color
我已成功改变了 _Layout 文件中ActionLinks的样式。他们成功地从我的Style.css文件中继承了样式:
<li>@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "navbar-brand" })</li>
当我尝试对 _LoginPartial 文件中的ActionLinks执行相同操作时:
<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" }, new { area = "" }, new { @class = "navbar-brand" })</li>
添加到 _LoginPartial ActionLink的引用是:
new { area = "" }, new { @class = "navbar-brand" }
这根本不起作用,但打破了应用程序。 这些链接是标准MVC而不是更改。
如何将样式应用于 _LoginPartial ActionLinks?
答案 0 :(得分:1)
你应该写:
@Html.ActionLink("Register", "Register", "Account", new { area = "" }, new { id = "registerLink", @class = "navbar-brand" })
答案 1 :(得分:0)
子问题:如何将导航栏品牌风格应用于 BeginForm ?
Html.BeginForm("Logoff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm", @class = "navbar-brand" })
这并不完全接受这种风格。应用了字体,但不幸的是,颜色不是。 这可能是因为区域引用中的错误?