CSS3 selector :first-of-type with class name?

后端 未结 9 2227
梦毁少年i
梦毁少年i 2020-11-22 03:06

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

9条回答
  •  生来不讨喜
    2020-11-22 03:25

    You can do this by selecting every element of the class that is the sibling of the same class and inverting it, which will select pretty much every element on the page, so then you have to select by the class again.

    eg: