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

后端 未结 9 1981
梦毁少年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:41

    As a fallback solution, you could wrap your classes in a parent element like this:

    This text should appear as normal

    This text should be blue.

    This text should appear red.

    This text should appear green.

提交回复
热议问题