I have defined a class in my main.css file.
.red {
color: #d14;
}
And using it like this.
<div class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li class="active red">
<a href="/admin/list"><i class="icon-leaf icon-white"></i>Admin</a>
</li>
</ul>
</div>
</div>
Besides my main.css I also import the twitter bootstrap css file.
This way it does not work. Is it because Bootstrap is overruling my color definition?
The only element in your markup that could visually apply this style is the
<a>, and that element has a lot of really specific CSS rules applied to it by Twitter Bootstrap, stuff like this:You’ll have to write something even more specific to get the style to apply:
Demo: http://jsfiddle.net/pYGaG/
You could use
!importanton the rule if you really had to, but I really feel that you should avoid it as much as possible. If this is a single element that has this style, consider adding anidto it, which carries a lot of weight specificity-wise:http://jsfiddle.net/pYGaG/1/
Here are a couple good articles on CSS specificity:
And as a side note, try to avoid presentational class names like
red. Use more meaningful ones that aren’t tied to the way it should look, but what it is (for example,.active-link).