Change the default header color in MVC5 app
Just paste this in your 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*/
in _Layout The Brand Name :
@Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand active" })
For Any Navbar Item
<li>@Html.ActionLink("Contact", "Contact", "Home", new { @class = "mynav nav-item active" })</li>
To make this change, go to: \Content\bootstrap.css
and find this code block:
.navbar-inverse {
background-color: #ff0000;
border-color: #808080;
}
In default MVC 5 web site, the background color of the header navigation bar is applied through .navbar-inverse
css class available in bootstrap.css
file under \Content\bootstrap.css
folder of your project.
To change this style, you can override it in the Site.css file instead of changing the base bootstrap css file itself.
Simply adding the following to your Site.css file should change the background color of the navbar.:
.navbar-inverse { background-color: #ccc !important; }