I'm going to be displaying the list items horizontally and I'd like to add a margin between the elements, but I do not want any margins on the exterior of the list.

Essentially, I want a margin-right of 10px on all of the list elements except for the last one. I suppose I could identify the last element with a class or id and override the margin-right to 0, but that seems a little awkward to me. Any better suggestions out there?

hm.. adding jQuery just for this problem... if there is no other use for a javascript framework on that site, then i would recommend a solution with normal Javascript and CSS — Sven Finke over 8 years ago

of course. I tend to take it for granted that jQuery will be available as it usually is on most of my sites :D — danwellman over 8 years ago

Should work fine, except in my experience, IE6 trips over the pseudo selector, so you need a separate entry for each of the two selectors (i.e. li:last-child { stuff } li.last-child { stuff }) — Olly Hodgson over 8 years ago