CSS - 伪元素与伪类
无    2014-04-26 10:28:34    499    0    0
life

http://www.w3.org/TR/css3-selectors/#pseudo-elements

:: 伪元素

Pseudo-elements allow authors to refer to this otherwise inaccessible information. Pseudo-elements may also provide authors a way to refer to content that does not exist in the source document.

简而言之, 很多不在DOM树的元素可以通过::伪元素来访问.

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

: 伪类

使用 :伪类 来操作的HTML本就在DOM中, 即使不用 :伪类 也可以通过添加id, class来实现.

  • :hover, :visited, :active, :focus
  • :first-child, :last-child, :nth-child(n), :nth-of-type(an+b)
  • :not

上一篇: HBase要点

下一篇: leanote 添加新功能-历史记录

499 人读过