Tony R
Tony R

Reputation: 11524

last-child selector with classname?

Can someone explain why last-child doesn't work when I use a classname selector with it? Is that not allowed?

http://jsfiddle.net/T2PgX/2/

Upvotes: 3

Views: 395

Answers (1)

BoltClock
BoltClock

Reputation: 723638

It's because the :last-child of your list is not a .group1.

The selector li.group1:last-child doesn't mean "the last li.group1 child"; it means "the li element that is the last child and has the 'group1' class".

Upvotes: 1

Related Questions