September 5th, 2009, 06:18 PM
Target last element of a list
Hi, How can I target the last element of a list. The number of items in the list is not always four. Thanks
September 5th, 2009, 06:39 PM
You can put the list items in an array and loop through, writing a conditional for the last item in it, (with a server side scripting language). That's the way I recommend.
There's also the last-child pseudo selector for browsers that support css3.
September 6th, 2009, 05:41 AM
I was thinking about last-child, but didn't want to use it.
I first thought that your server side solution wouldn't work since I also need a selected class, but then recalled that more than one class can be applied to an element.