关于css:css杂记

5次阅读

共计 440 个字符,预计需要花费 2 分钟才能阅读完成。

CSS 中的伪类有:

  • :link——未拜访过的链接;
  • :visited——拜访过的链接;
  • :hover——鼠标悬停的元素;
  • :focus——获取焦点的元素;
  • :active——激活的元素(例如一个被单击的链接元素);
  • :first-child——作为其余元素第一个子元素的元素;
  • :lang()——依据元素的 lang 属性确定的元素。
  • :target
  • :root
  • :nth-child()
  • :nth-of-type()
  • :nth-last-of-type()
  • :first-of-type
  • :last-of-type
  • :only-of-type
  • :only-child
  • :last-child
  • :empty
  • :not()
  • :enabled
  • :disabled
  • :checked

CSS2.1 中的伪元素有:~~~~

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

那么区别在哪儿呢?区别就在于这些伪选择器影响文档的形式不同。伪类的体现有点儿像给文档增加类,而伪元素的成果就如同有元素被插入到了文档中。

正文完
 0