father :nth-child(x) 只能選擇 father元素的直接子項這一級,也就是father元素下的N個平級的子項中的某一個。dom
特別注意:father的再深層次的dom,它是找不到的。spa
以下面:
nav ul li : nth-child(3) adi
若是要選擇深的dom的話,按以下來寫:co
.row-adv > div:nth-child(1) .adv-box,
.row-adv > div:nth-child(3) .adv-box
{
background: #21af98;
}
.row-adv > div:nth-child(2) .adv-box,
.row-adv > div:nth-child(4) .adv-box
{
background: #648b85;
}background