first-child和first-of-type理解

是p元素

first-child、第一个是p
nth-child(n)、第n个是p
last-child、最后一个是p
nth-last-child(n)、最后n个是p
only-child、只有p

个p元素

first-of-type、第一个p
nth-of-type(n)、第n个p
last-of-type、最后一个p
nth-last-of-type(n)、最后第n个p
only-of-type、只有一个p

你可能感兴趣的:(first-child和first-of-type理解)