Skip to content

结构化伪类 ​

位置相关 ​

  • :first-child、:last-child
  • :nth-child(2n+1) 奇数行,even、odd 简便写法
  • :nth-of-type 在同类型兄弟中计数

其它 ​

  • :empty 无子节点(含文本)的元素
  • :not(.类名) 排除匹配

小结 ​

列表斑马纹、第一项高亮等场景非常实用。