The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › [Solved] Space li elements without spacing the last one?
Hello, I’m looking for a way to space my li elements. If I was just to add
div li { margin-right: 10px; }
then the last li element would have a uneeded margin-right. So how can I overcome this?
Alright, thank you. Worked like a charm and I shall do that next time.
Might want to bookmark this: http://www.w3.org/community/webed/wiki/Advanced_CSS_selectors
I usually put a margin-left on the list items and do one of these:
li:first-child { margin-left:0; }
First-child is supported back to IE7.