Hello, I'm trying to set up a different appearence for menu items when theyr status is "active" (on current node). I really have tried everything, and nothing works: or better, it works on admin menu, but not on other blocks. If I add to the main css file (style.css) this input:
li.active-trail>a {
color: #D00000;
font-weight: bold;
}
admin menu gets correct active classes, no matter how deep navigation goes, but other menus don't change. I have other css files where different menu blocks are configured, but adding this to them still doesn't work. Same thing if I change css part for the region where blocks are (sidebar): nothing works. I've also tried to change dhtml menu css, nothing.
Could be related to block theme module? if I try to change the function theme_menu_item or php_menu_item on template.php then I get an error with dhtml module, but if I uninstall dhtml and try again configuring css to have an active state, still nothing works. What can I do to find out what's the matter?
If anyone has any suggestion it'd be a great help! thanks
Comments
Just use active
The way you wrote your CSS selector, the color + bold will only happen when the "a" tag is directly contained within an "li" tag with a class of "active-trail". It's unlikely that every instance of this menu item is setup that way, so that's why it doesn't get changed. It's also possible that you have a selector override somewhere else in your CSS. Either (or both) may be the case - I can't tell without seeing your code.
If you look closely the "a" tag already has a class of "active" within it. So if you only want to style the anchor itself simply use:
The "li" part would be needed only if you wanted to style the "li", such as adding a background color, padding, etc.
---------------------------------
Steven Wright
Slalom
Thanks for this suggestion,
Thanks for this suggestion, which can be useful anyhow... meanwhile I found out what caused the problem, and it was such a stupid thing: menus items paths. The "error" I made was to put all paths for menus items copying the original urls (ex: http://www.etcetcetc), instead of keeping node/111 ... and that's why active class worked only for admin menu... it was the only one left built with drupal default nodes name instead of paths generated with pathauto.
... is this normal or still does it indicates that I have some bug in my installation, I wonder?
Thanks again