AlexStack
AlexStack

Reputation: 17421

Excluding last-child

ul li:last-child selects the last element of a list.

ul li:not(...) selects an element that is not something

What is the CSS selector for excluding the last child of an element? I tried ul li:not(last-child) but it didn't work.

Upvotes: 61

Views: 64819

Answers (1)

minaz
minaz

Reputation: 5780

Did you try:

ul li:not(:last-child)

Upvotes: 160

Related Questions