Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS selecting list items all but last? Re: selecting list items all but last?

#55488
cybershot
Participant

okay, I tried it and this is what happened. I am working in wordpress. I am adding a character in between the navigation. Every time you add a new menu item, it automatically adds the character. So I had to add php code to the wp_nav_menu function to get it to add the image between the nav, so it looks like this


wp_nav_menu( array( 'container' => false, 'theme_location' => 'primary','after' => '
  • ' ) );

    now I tried the fix and it messes up the nav. I tried like this


    #nav ul#list li.star + li.star

    #nav ul#list li + li

    it doesn’t work. This is what I ended up getting to work


    #nav ul#list li.star {
    background:url(images/star.png) no-repeat;
    width: 26px;
    height: 38px;
    }

    #nav ul#list li.star:last-child {
    background:url(images/blank.png) no-repeat;
    width: 26px;
    height: 38px;
    }

    I understand now what you were saying jamy, it would be easier but I can’t get it to work