I need to add separators between elements of navigation. Separators are images.
My HTML structure is like: ol > li > a > img
.
Here I come to two possible solutions:
li
tags for separation (boo!),What to do?
Simply use the separator image as a background image on the li
.
To get it to only appear in between list items, position the image to the left of the li
, but not on the first one.
For example:
#nav li + li {
background:url('seperator.gif') no-repeat top left;
padding-left: 10px
}
This CSS adds the image to every list item that follows another list item - in other words all of them but the first.
NB. Be aware the adjacent selector (li + li) doesn't work in IE6, so you will have to just add the background image to the conventional li (with a conditional stylesheet) and perhaps apply a negative margin to one of the edges.