I need to assign different classes to all of the menu items in my primary links because each item is preceded by a different icon. How could I go about doing this?

EDIT: I found a module that seems to achieve this -- http://drupal.org/project/menu_attributes. Has anyone used it? Is it an effective solution?

  • just curious as to why you can't use the generated menu item classes provided by the core menu system for your use case? ie. "menu-XXX", they don't change after you create the menu item and are unique across your site. if it is really only some icons you're trying to drop in with css then dropping in a whole new module seems like unnecessary overhead. Sep 11, 2011 at 12:40
  • My client wants a different icon by each menu item which I add by creating a different css class (a.home, a.about, etc.), Drupal's core menu system only seems to assign separate styles to the first and last menu items, I'm guessing because typically they have different padding/margin values than the other items in a menu.
    – Jane
    Sep 11, 2011 at 13:23
  • sure, the links themselves don't have classes on them, but the <li> parent elements should each have unique classes on them like "menu-XXXX" where XXXX is a number. Sep 11, 2011 at 13:40

1 Answer 1


Yes, the Menu Attributes module works well. I used it on nearly all projects.


Your Answer

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

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