I have the following headermenu:
%div.header
%div.span-25
= link_to logo, root_path
%div.span-25
%div.headermenu
%ul
- if current_page?(root_path)
%li.currentmenu
= link_to "Home", root_path
- else
%li
= link_to "Home", root_path
- if current_page?(user_path)
%li.currentmenu
= link_to "User", user_path
- else
%li
= link_to "User", user_path
In the styleshhet I have:
.headermenu {
border-radius:0px 0px 5px 5px;
-moz-border-radius:0px 0px 5px 5px;
margin-top:-5px;
position:relative;
display:block;
height:42px;
font-size:11px;
font-weight:bold;
background:transparent url('darkgray_background.gif') repeat-x top;
font-family:Arial,Verdana,Helvitica,sans-serif;
text-transform:uppercase;
}
.headermenu ul {
margin:0px;
padding:0;
list-style-type:none;
width:auto;
}
.headermenu ul li {
display:block;
float:left;
margin:0 1px 0 0;
}
.headermenu ul li a {
display:block;
float:left;
color:#000;
text-decoration:none;
padding:13px 12px 0 12px;
height:28px;
}
.currentmenu {
color:#fff;
border-radius:5px;
-moz-border-radius:5px;
background:transparent url('darkgray_backgroundOVER.gif') no-repeat top center;
}
So, the current header menu will be highlighted. The background image of the highlighted menu is correct (‘darkgray_backgroundOVER.gif’), but the font is black (#000), and not #fff as it supposed to be. Firebug shows a cancelled out font from currentmenu:
Inherited from li.currentmenu
element.style { color: #FFFFFF;}
Instead above this is shows:
.headermenu ul li a {
color: #000000;
etc….
}
Why doesn’t it display the font in white? In black it’s almost not legible. What can I do to have the font of the current menu in white and keep the font of the other (not current menus) in black?
You need to specify the color on the anchor tag itself, not just the menu class. Your CSS isn’t specific enough, and so the #000 over-rides.
will be more specific and should target the anchor tag correctly.