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?
If there isn't a pressing need to use images for the separators, you could do this with pure CSS.
nav li + li:before{
content: " | ";
padding: 0 10px;
}
This puts a bar between each list item, just as the image in the original question described. But since we're using the adjacent selectors, it doesn't put the bar before the first element. And since we're using the :before
pseudo selector, it doesn't put one at the end.