I am trying to style one element of my navigation. To display the whole navigation I am using:

            wp_nav_menu( array(
                'theme_location' => 'menu-1',
                'menu_id'        => 'primary-menu',
            ) );

It returns 4 main menu items. Only the last item should be positioned at the right. The rest should stay at the left. I checked the id of the desired item and tryed to style it separetly using:

li#menu-item-258.menu-item.menu-item-type-post_type.menu-item-object-page menu-item-258{color:red;}

For some reason it does not work. Any hints?


You can easily make the text of the last item right position with:

ul#nav li:last-child span {
   text-align: right;
  • In my case this also worked: li#menu-item-259 a{float:right;} li#menu-item-258 a{margin-left: 140px;} – Vanina Yordanova Jan 2 '18 at 12:56
  • 1
    This is not the right method ! – Mostafa Norzade Jan 2 '18 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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