How do CSS specificity levels between classes/pseudo-classes and elements/pseudo-elements work?

前端 未结 2 1129
遇见更好的自我
遇见更好的自我 2021-01-12 00:07

I\'m using the following definitions (adapted from the CSS2 spec http://www.w3.org/TR/CSS21/cascade.html#specificity )

  • a = using the style attribute on an elem
2条回答
  •  悲哀的现实
    2021-01-12 00:51

    I guess that :first-line is more specific than just .content. So the first line of the text is pink, but the bullet of the list is green (and yellow on hover). Everything is good, as for me.

    Imagine that the :first-line selector is just a nested text node selector, like:

  • The first line
    The second line
  • It operates on the nested element, so it is more important than any other selector.

提交回复
热议问题