If you are using jQuery in your project, or are willing to include it you can call nth-last-child
through its selector API (this is this simulated it will cross browser). Here is a link to an nth-last-child
plugin. If you took this method of targeting the elements you were interested in:
$('ul li:nth-last-child(1)').addClass('last');
And then style again the last
class instead of the nth-child
or nth-last-child
pseudo selectors, you will have a much more consistent cross browser experience.