So I tried googling this but find it quite difficult to get the right search terms in.
I'm trying to namespace a pseudo-selector on only a certain class
In this example, without the class the last Hi
should be blue. I would expect this code to turn the second span
blue, which is not the case. Am I doing something wrong or do I have an unreasonable expectation of what CSS should be doing?
span.dinosaur:last-child {
color: blue;
}
<body>
<span class='dinosaur'>Hi</span>
<span class='dinosaur'>Hi</span>
<span>Hi</span>
<span>Hi</span>
</body>