Can someone explain why the last-child doesn't work when I use the class selector with it? Is this not allowed?
This is because :last-child
your list is not .group1
doesn't mean "last li.group1
child"; it means "the element li
that is the last and has the class" group1 ".