Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Nope. :first-of-type doesn't look at the class either.
    – BoltClock
    Commented Jan 2, 2017 at 8:45
  • You are right @BoltClock, it doesn't. There is no option to do so with class as far as I know. You could however reach the first blue with those other selectors I included in the answer.
    – Alvaro
    Commented Jan 2, 2017 at 9:02
  • I agree. I do think that :first-of-type shouldn't even be considered since a ul can only have li as children (which means both pseudo-classes will always match the same element), and I just personally don't like changing the HTML to fit a CSS selector. But I removed my downvote.
    – BoltClock
    Commented Jan 2, 2017 at 9:06