Selecting an element combining nth-of-type() and a class/ID


We should be able to select an element combining nth-of-type() and a class/ID.
If I try for instance, it doesn't select the
second list item *among* those that have a "new" class. You can only
select the second list of the <ul> item *if* at the same time it has a
"new" class.
The only way that I know, to first select list items with a "new"
class, and then, among them, select the second item, is this:


It is too cumbersome. We need an easier solution. Imagine if we had
several classes in this unordered list, and also if we had to select
the 5th list item...The code would be huge. We need a solution.
(I need this code in an ad-removal tool that injects CSS into pages to
hide specific elements of the pages)


Received on Monday, 30 March 2009 08:19:30 UTC