0

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?

3
  • 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. Commented 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
    Commented 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. Commented Sep 11, 2011 at 13:40

1 Answer 1

2

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

0

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.