0

我有一个菜单,我想在按钮右侧插入分隔符,但不想在子菜单上。HTML:

<ul id="nav" class ="pull-right">   

    <ul id="menu-menu1" class="sf-menu sf-vertical"><li id="menu-item-278" class="wordpress-classes"><a href="http://localhost/wordpress/">HOME</a>
            <ul class="sub-menu">
                <li id="menu-item-314" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-296"><a href="http://localhost/wordpress/">Home</a></li>
                <li id="menu-item-303" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-296"><a href="http://localhost/wordpress/?page_id=57">Products</a></li>
                <li id="menu-item-302" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-296"><a href="http://localhost/wordpress/?page_id=63">Dreams</a></li>
                <li id="menu-item-301" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-296"><a href="http://localhost/wordpress/?page_id=106">Vouchers</a></li>
            </ul>
        </li>
        <li id="menu-item-285" class="wordpress-classes"><a href="?page_id=66">Plans</a>
            <ul class="sub-menu">
                <li id="menu-item-294" class="wordpress-classes"><a href="http://localhost/wordpress/?page_id=66">Travels</a></li>
                <li id="menu-item-293" class="wordpress-classes"><a href="http://localhost/wordpress/?page_id=103">Pricings</a></li> 
        </li>
    </ul>
</ul>
</ul>

CSS(我想插入):

   background-image: url(images/sep_menu.jpg);
    background-repeat: no-repeat;
    background-position: right; 

我无法创建这些类,因为它们在 wordpress 中。这些类是这样的:

menu-item menu-item-type-post_type menu-item-object-page menu-item-294

我该怎么办?谢谢!

4

2 回答 2

0

你可以这样用 jQuery 做到这一点:

$(function () {
   $('ul:eq(0) li').css({
     'background-image': 'url(images/sep_menu.jpg) right no-repeat'
   });
});
于 2013-01-10T11:25:53.327 回答
0
#menu-menu1 li {
    background-image: url(images/sep_menu.jpg);
    background-repeat: no-repeat;
    background-position: right; 
}

#menu-menu1 ul li {
    background-image: none; 
}
于 2013-01-10T11:28:34.860 回答