I am using the main menu /admin/structure/menu/manage/main

There are a couple of links that I want to display only in mobile devices, and then also another couple of links that I want to display only in laptop devices. Can I do this without needing two separate menus? I guess one way would be to attach a css class to the relevant links but looking at /admin/structure/menu/item/1/edit there is no option to add classes to a menu link in the menu UI.

I don't want to use CSS nth-child because if in future the menu is edited / reordered then any nth-child rules will get messed up.

So can anyone tell me how to add an option to add classes to individual menu links in the menu UI - and / or some alternative route.

1 Answer 1


The Menu Link Attributes contrib module adds the option to assign each menu link a class in the admin UI.

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.