Add CSS class to latest menu item

What is the best practice to add a CSS class to the last menu item in the range?

There is not a class config property for a menu item right? And how would I set the target position of a menu item?

You don’t even need to do that. Just use the :last-child css pseudo selector.

Using the Weight menu property.

I know that you can use the :last-child selector. We are using Block Element Modifier methodology in our project. So I need to create a modifier class like

c-nav__item--last-item

Perhaps range last 1…?

Within your range {{ if eq .Identifier "somelastmenuitem" }}.... add class

1 Like