nth-child(n)和nth-of-type(n)比较

代码

图解伪类nth-child(n)和nth-of-type(n)

效果

图解伪类nth-child(n)和nth-of-type(n)

nth-child(n)和nth-of-type(n)选择方式

图解伪类nth-child(n)和nth-of-type(n)

注意:

  • nth-child(n)和nth-of-type(n):选择的下标是从1开始
  • 关于两个伪类的n取值(可为表达式):
    图解伪类nth-child(n)和nth-of-type(n)
    图解伪类nth-child(n)和nth-of-type(n)

相关文章: