Home › Forums › CSS › selecting list items all but last? › Re: selecting list items all but last?
I think you may have misunderstood what I meant when I said “easier” (I should have explained). It’s easier for the browser to target the first child and also easier to get it working on most browsers. :last-child is very heavy compared to :first-child or element + element and the latter works on IE7+, whereas :first-child works on IE8+ and :last-child only works on IE9. (these work on the latest versions of all other major browsers such as Chrome, Firefox, Opera, Safari)
If you don’t mind ignoring IE then :last-child is fine, however, if you want to include it then I suggest element + element or :first-child
#list li + li{background: red !important!;}
Try that, itshould make all backgrounds red except the first and you can work on it from there.