一、伪类选择器——选择子代选择器
1.表示选中ul下的第二个li,字体为红色
例:ul li:nth-child(2){
color:red;
}
2.选择偶数项
例:ul li:nth-child(even){
color:red;
}
3.选择奇数项
例:ul li:nth-child(odd){
color:red;
}
4.父级元素下只存在一个子级的时候
(1)例:. box em:only-child{
color:red;
}
(2)例:. box em:only-of-type{
color:red;
}
5.选中父