Reputation: 661
I have a simple header with some menu items:
<div id="header">
<ul id="menu">
<li class="item">
<a class='loginlinks' href='/signup'>Sign Up</a>
<a class='loginlinks' href='/login'>Log In</a>
</li>
</ul>
</div>
I am trying to change the Sign Up and Log In text colour to white using the code below but it's having no effect...the text keeps inheriting the global text colour of red.
.loginlinks a {
color: white;
}
What am I doing wrong here?
EDIT: I see my error, however even changing css to a.loginlinks did not do the trick.
RESOLVED All correct answers, I selected the reference to firebug as that ultimately helped me identify the problem. Thanks to everyone.
Upvotes: 4
Views: 302
Reputation: 54016
Best practice is to use color code (hex), not the name.
a.loginlinks {
color:#FFFFFF;
}
because assigning color by color name is now deprecated.
note: if you still have the problem then try to debug with firebug, it may be that some other property is inherited
Upvotes: 4
Reputation: 11148
that's because there are no .loginlinks a
at your DOM.
In other words, check it again and you'll see that the class .loginlinks
is attached to the a
.
So, in order to meke it work, just use this CSS:
a.loginlinks {
color: white;
}
EDIT: after reading the OP edit, the solution depends on how the "global" a
are behing defined.
If the OP is "desperate" he/she can use the !important
property, whch will override all other definitions.
Like this:
a.loginlinks {
color: white !important;
}
Upvotes: 1
Reputation: 152617
If I'm assuming your condition correctly then it will be solve like this
body {background:red;color:red}
#header a {color:yellow}
#header a.loginlinks {color: white }
See example here http://jsfiddle.net/pyNEe/
Upvotes: 0
Reputation: 237817
That says "a
tags within elements of the loginlinks
class". You want "a
tags that have the loginlinks
class":
a.loginlinks {
color: white;
}
Upvotes: 4