Alex Rivera | Logout

How can I select all children of an element except the last child?

Asked 2010-04-04T04:17:54.493
600

How would I select all but the last child using CSS3 selectors?

For example, to get only the last child would be div:nth-last-child(1).

Edit
Report

1 Answer

20

When IE9 comes, it will be easier. A lot of the time though, you can switch the problem to one requiring :first-child and style the opposite side of the element (IE7+).

answered 2010-04-14T15:51:31.790

Your Answer