Reputation: 327
It's Amazing that there is no easy to find answer to this one:
I want to change the textcolor of all the ActionLinks in my header. I have tried this code:
CSS:
.navbar-brand { color: black }
.navbar-brand:visited { color: black }
.navbar-default-color { color: black }
CSHTML:
@Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>@Html.ActionLink("Senders", "Index", "Senders", new { @class = "navbar-brand" })</li>
<li>@Html.ActionLink("Responders", "Index", "Responders", new { @class = "navbar-brand" })</li>
</ul>
All of the ActionLinks in my header inherits style from navbar-brand. But only the Home ActionLinks gets it's text color changed. (See picture) https://i.sstatic.net/lOsw8.png
Notice that the ActionLinks do in fact inherit text-size and font. Everything but the bloody text-color!
How do I change the ugly grey color of the other ActionLinks using CSS?
Sorry for dumb question, but why doesn't this just work?
Upvotes: 0
Views: 11374
Reputation: 12491
The easiest way:
.navbar-brand { color: black !important }
.navbar-brand:visited { color: black !important }
.navbar-default-color { color: black !important }
.navbar-inverse { color : #FFFFFF !important }
I belive that this happends becouse li
element has his own style and css rules first get styles from element selectors and then class selectors.
You can watch this with Chrome -> F12 -> Inspect element
Upvotes: 8