伪元素和伪类

解释

:英文读作colon

伪类

  • :link
  • :visited
  • :hover
  • :active
  • :first-child
  • :nth-child
  • :after
  • :before
  • :first-letter

伪元素

对于伪元素使用一个还是两个冒号?答案是:在大多数情况下都可以. 两个冒号::是在CSS3中引入,IE8以下包括IE8不支持,CSS3为了兼容性也允许你写一个冒号

  • ::selection
  • ::first-line/:first-line
  • ::first-letter/:first-letter
  • ::before/:before
  • ::after/:after

An Ultimate Guide To CSS Pseudo-Classes And Pseudo-Elements

results matching ""

    No results matching ""