Asp.net

更改 MVC5 應用程序中的預設標題顏色

  • October 13, 2020

我創建了 MVC5 應用程序,在視圖索引中,標題顏色為黑色,我想更改它,我在哪裡可以找到它?

我嘗試搜尋#000000,但它在很多地方……

在預設的 MVC 5 網站中,標題導航欄的背景顏色通過項目文件夾下的文件中.navbar-inverse可用的 css 類應用。bootstrap.css``\Content\bootstrap.css

要更改此樣式,您可以在 Site.css 文件中覆蓋它,而不是更改基本引導 css 文件本身。

只需將以下內容添加到您的 Site.css 文件即可更改導航欄的背景顏色:

.navbar-inverse { background-color: #ccc !important; }

只需將其粘貼到您的 site.css

/*green navbar*/ 
.navbar-inverse { background-color:#28a745 !important;  }
a.mynav {background-color:#28a745 !important;}
.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav > li > a  
{color: #ffffff;} 
/* end of green navbar*/ 

在 _Layout 品牌名稱:

@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand active" })

對於任何導航欄項目

<li>@Html.ActionLink("Contact", "Contact", "Home", new { @class = "mynav nav-item active" })</li>

引用自:https://stackoverflow.com/questions/23042579