1、first-child
first-child表现挑选列表中的第一个标签。代码以下:
li:first-child{background:#090}下面的意义是,li 列表中的 第一个li模块的背景色彩。
2、last-child
last-child表现挑选列表中的最初一个标签,代码以下:li:last-child{background:#090}
3、nth-child(3)
表现挑选列表中的第3个标签,代码以下:li:nth-child(3){background:#090}下面代码中的3也能够改成别的数字,如4、5等。想挑选第几个标签,就填写几。
4、nth-child(2n)
这个表现挑选列表中的偶数标签,即挑选 第2、第4、第6…… 标签。
5、nth-child(2n-1)
这个表现挑选列表中的奇数标签,即挑选 第1、第3、第5、第7……标签。
6、nth-child(n+3)
这个表现挑选列表中的标签从第3个起头到最初。
7、nth-child(-n+3)
这个表现挑选列表中的标签从0到3,即小于3的标签。
8、nth-last-child(3)
这个表现挑选列表中的倒数第3个标签。