Is it possible to use the CSS3 selector :first-of-type
to select the first element with a given class name? I haven\'t been successful with my test so I\'m thin
I found a solution for your reference. from some group divs select from group of two same class divs the first one
p[class*="myclass"]:not(:last-of-type) {color:red}
p[class*="myclass"]:last-of-type {color:green}
BTW, I don't know why :last-of-type
works, but :first-of-type
does not work.
My experiments on jsfiddle... https://jsfiddle.net/aspanoz/m1sg4496/