0

Lets say I have a menu block in my header region. And by default Drupal gives .active class for links that are active. I need to get rid of that .active class, because the CSS/HTML version of the theme (which I am porting to Drupal 7) doesn't have .active class and its not just .active, there are many more.

I need this because now default Drupal rules like a.active overrides my themes CSS of a simple a rule.

Please, do not recommend !important.

2
  • isn't it template.php adding this class to the menu item ?
    – AKS
    Commented Jan 29, 2013 at 19:37
  • I am developing a theme from scratch and my theme's template.php is empty.
    – user13176
    Commented Jan 29, 2013 at 19:40

1 Answer 1

1

If you want to override a core stylesheet, add it to your theme .info file.

That way, the .active class need have no CSS rules

e.g: themename.info

stylesheets[all][] = system-menus.css

To override a core or contributed module style sheet, it must be specified in your theme's .info file. Drupal overrides are cascading and your theme's stylesheets override any that were previously declared. For example, system-menus.css is located at "modules/system/system-menus.css". If you place a file with the same name in your theme's folder and add the following entry to the .info file, the original system-menus.css file will be ignored and your version will be loaded in its place.

More info here: http://drupal.org/node/263967

See also hook_css_alter for a code-based solution to remove stylesheets.

1
  • I want to unset a CSS rule, ID, class - not the entire stylesheet. Maybe if it is not possible to do that maybe it is possible to rename a class? for example rename default li.last classes to li.latest?
    – user13176
    Commented Jan 31, 2013 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.