views:

702

answers:

2

I am trying to include a small image as a separator in my menu and I am having the time of my life (sarcasm). In order to create a menu like below I am using the code under the image.

menu item sample with separator

<ul id="div-menu">
    <li class="current">
        <div class="menu-fill fill">
            <div class="menu-left left">
                <div class="menu-right right">
                    <a href="#" title="Home">Home</a>
        </div></div></div>
    </li>
    <li>
        <div class="menu-fill">
            <div class="menu-left">
                <div class="menu-right">
                    <a href="#" title="About Us">About Us</a>
        </div></div></div>  
    </li>

My problem is that I am not able to add the little separator image between the li elements. Any ideas?

A: 

Maybe you could set the separator image as the list image:

ul#div-menu li
{
    list-style-image: url("/images/separator.gif");
}

ul#div-menu li:first-child /* Disable for the first li */
{
    list-style: none;
}
Laurent le Beau-Martin
+1  A: 

list-style plays up on different browsers. the best way to do it is

ul#div-menu li { background: url(/images/seperator.gif) no repeat 0 0; }

the first-child pseudo-class doesn't work on all browsers, so you can apply a 'first' class to the first li and set background to none for that

ul#div-menu .first { background: none; }

note: you will need to use some amount of padding on the li to push the text away from the background image. you can adjust the position of the background image using the last two parameters (which i've set to 0). the first digit is x-axis and the second one is y-axis. so to move the background image 2px to the right and 2px up

ul#div-menu li { background: url(/images/seperator.gif) no repeat 2px -2px; }
pixeltocode