I have created a navigation bar that is centered with CSS which works. Each li item is separated with a border which is a background image. When hovering on the nav items, the separator disappears because the hover changes the background (I guess) but I wonder how I can fix this, padding or margin can’t work because it will just shift the li element.
Second problem is that the sub menu items aren’t displaying correctly and I have no idea why…
Demonstration: http://jsfiddle.net/Xenios/tfbhh/9/embedded/result/
The code: http://jsfiddle.net/Xenios/tfbhh/9/
I’m trying to get this to work for almost a week, and I’m quite tired of it, so I’m looking here for support.
You can use a left padding equal to the width of the separator on the
liand change only the background on thea. Also I noticed you usedclass="separator"on all but the first list item. You could replace that with the:first-childpseudo selector. Then you would get something like this:Edit: The CSS above covers the core styling of this solution. Here’s a working example (using background colors):
http://jsfiddle.net/haa5X/3/
The complete CSS:
The complete HTML:
Edit 2: Sorry, missed the part of the submenu:
http://jsfiddle.net/haa5X/4/
The complete CSS:
The complete HTML: