Timeline for Doesn't CSS first-child or last-child work with class wise?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 2, 2017 at 9:09 | comment | added | amedina | @BoltClock You are right. Here's a codepen with the order changed. | |
Jan 2, 2017 at 8:53 | comment | added | BoltClock | This has nothing to do with specificity. Specificity does not preclude both .blue:first-child and .blue:last-child matching different elements (or the same element) at the same time. | |
Jan 2, 2017 at 8:52 | history | edited | amedina | CC BY-SA 3.0 |
corrected answer
|
Jan 2, 2017 at 8:50 | comment | added | amedina | Sorry, I didn't read it, "mea culpa". In that case, both selectors has the same "precision level", I mean, they aren't more precise than each other, so "the last one" rule applies and the one colored is the last blue. | |
Jan 2, 2017 at 8:45 | comment | added | BoltClock | "the blue one is similar" And that's why the asker expects .blue:first-child to match the first .blue element. But it doesn't. | |
Jan 2, 2017 at 7:29 | history | answered | amedina | CC BY-SA 3.0 |